JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Parameterizing Single and Double Pendulum Examples #2801

Open cd155 opened 3 years ago

cd155 commented 3 years ago

In the nth pendulums, we parameterize masses and rods. In addition, more derivatives will be parameterized (ith part), such as velocity, acceleration, angle, speed of angle, acceleration of angle. However, when we work on the single pendulum, we don't want to parameterize each variable. This is the ideal situation, but it hasn't be done in this way.

In the double pendulum example, there will be 1 and 2 subscripts in most elements. They are indicating variables relate to the first mass and the second mass. In the single pendulum example, there will be no subscript because it is a natural way to not have subscript when each element only has quantity in one. This raises the problem that some duplicates occur between two examples.

In the double pendulum example, some definitions relate to the first mass are almost identical with its counterpart in the single pendulum example. For example, the equation of calculating the velocity in the horizontal direction in the first mass is almost identical to the equation of calculating the velocity in the horizontal direction in its only mass. The only difference is the subscript. They are more in these two examples. If we think about solving the nth pendulum, we could subscript between 1th to nth. Technically, it is not wrong to put 1 subscript in the single pendulum, but it is just not a natural way we present it.

Ideally, the ultimate goal is that removing those duplicate knowledge.

Here are all duplicates in the Single and Double Pendulum Example.

General Definition: Double Pendulum Single Pendulum Definition Similarity
vₓ vₓ₁ velocity in x-direction Identical except subscript
vᵧ vᵧ₁ velocity in y-direction Identical except subscript
aₓ aₓ₁ acceleration in x-direction Identical except subscript
aᵧ aᵧ₁ acceleration in y-direction Identical except subscript
xForce1 hForceOnPendulum force in pendulum Partially identical
yForce1 vForceOnPendulum force in pendulum Partially identical
pₓⁱ pₓ₁ position of the pendulum in x-direction Identical except subscript
pᵧⁱ pᵧ₁ position of the pendulum in y-direction Identical except subscript

relate to #2730

JacquesCarette commented 3 years ago

This seems to intersect with what @tingyuw was talking about this morning, and where @smiths was suggesting some name changes to get around double-superscripts (where here it's double-subscripts). We really shouldn't use double-sub/superscripts!

smiths commented 3 years ago

@cd155 for velocity you can use u for v_x and v for v_y. For the position you sometimes see a and b for p_x and p_y, respectively. The acceleration is a tough one. For acceleration I'm not sure how to replace a_x and a_y. Maybe do a bit of googling and see what others use to represent the components of the acceleration vector?

cd155 commented 3 years ago

@smiths @JacquesCarette Thanks for pointing it out. I can search around to see how other people represent them. Just want to double-check, in the situation listed above, should we just use another alphabet to avoid double sup/subscript.

smiths commented 3 years ago

Yes, we will aim to use a notation that avoids the double sup/subscripts. However, we need to pick a notation that is still commonly used. We don't want to introduce something that is arbitrary. It might be technically correct, but it will be hard for domain experts to understand.

In some cases a double subscript or superscript could be fine, like if we were referencing the ith row and jth column of matrix A (A_{ij}). It isn't always a bad thing. :smile: