Help with Symbolic Programming

Hi all, I am new to Julia (coming from Python).

I need some help with defining equations and extracting Mass, Stiffness and Damping Matrices. Does anyone have some advice to generate these matrices using the following equation, for example:


Many thanks!

1 Like

Welcome to the community!

Some questions and remarks:

  • I do not see any equation. This looks like a term, not like an equation.
  • what is the definition of C_{pi} and K_{pi} and x and q and Z_{si}? Are these variables scalars, vectors or matrices and if yes of which dimension?

Hi, and thank you!

That is correct, it is a term, the “right hand side” of the equation is the applied force. The term posted contains the description of a railway track and sub elements beneath it (such as sleepers ballasts and the sub-grade). It is in a 2 dimensional state at the moment, but I plan to extend to 3D soon.

Cpi and Kpi are constants that describe the rail pad stiffness and damping, whereas x is a float variable that describes location along the x-axis. q and Zsi are generalized coordinates and as such are in a single vector where the first K elements are q’s and next N elements are Zs.

Elements that have a coefficient that are a second derivative of the coordinate vector go to the mass matrix, elements that have a coefficient that are a first derivative of the coordinate vector go the damping matrix and elements that are a coefficient of the coordinate vector go to the stiffness matrix.

You said you come from Python: Did you try to implement this in Python?

If you would post a code snippet, I guess much more people would be willing to help.
Otherwise your question is still very unclear and it is unlikely that people can help.

2 Likes

Hi again,

I did implement in Python and have done so again in Julia by using for loops - not to worry, it produces the same result as the Python script. Will update when I find a quicker method.