New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ang_vel_in() could give a simpler result for body fixed angular velocities #23130
Comments
I guess the issue is that direction cosine matrices have no knowledge of how they were created, but when |
@moorepants I am working on this issue |
I think that when |
@soma2000-lang if you want to work on this, the best way to signal that is to open a draft pull request where we can observe your work on it. That lays "claim" a bit more than just a comment in this issue. I can also give feedback there as you work on it. |
This actually looks like a regression. In SymPy 1.0, I get the preferred answer: In [1]: import sympy as sm
In [2]: sm.__version__
Out[2]: '1.0'
In [3]: %paste
import sympy as sm
import sympy.physics.mechanics as me
psi, theta, phi = me.dynamicsymbols('psi, theta, varphi')
## -- End pasted text --
In [4]: %paste
A = me.ReferenceFrame('A')
B = me.ReferenceFrame('B')
## -- End pasted text --
In [5]: me.init_vprinting()
In [6]: B.orient(A, 'Body', (psi, theta, phi), 'ZXZ')
In [7]: B.ang_vel_in(A)
Out[7]: (sin(θ)⋅sin(varphi)⋅ψ̇ + cos(varphi)⋅θ̇) b_x + (sin(θ)⋅cos(varphi)⋅ψ̇ - sin(varphi)⋅θ̇) b_y + (cos(θ)⋅ψ̇ + varṗhi) b_z |
Git bisect tells me that this is the commit that changed the result: |
This is the PR in which the commit appears: #18844 |
This is the code that generates the angular velocity and it does use sympy/sympy/physics/vector/frame.py Lines 882 to 898 in 1de2e07
|
The line 890 |
Ok I opened #23140 for the deep issue, but we can also improve |
Also, I think this issue plays a role here: #23075 |
A super quick fix would be to add trigsimp right after solve in |
If you set up a body fixed rotation and then call
.ang_vel_in()
I would expect the simplest form of the angular velocity to be returned, because we know apriori what the angular velocity is for any body fixed rotation.gives:
We know the answer to this and I though that the code was supposed to return the simpler form for a lookup table. The simple form is:
The manual calculation is:
We have this function:
https://github.com/sympy/sympy/blob/master/sympy/physics/vector/functions.py#L227
which has this big lookup table but I don't think it is used.
The text was updated successfully, but these errors were encountered: