I typically use `.xreplace()` if I'm simply swapping one variable for
another. But subs or replace should work. Sympy mechanics uses t =
me.dynamicsymbols._t internally. Are you using your own defined t that
different? If soe the derivative terms could print the same but aren't
actually the same symbols.

You'll need to share some code that reproduces the substitution error so we
can run it and try it.

Jason
moorepants.info
+01 530-601-9791


On Sun, Mar 6, 2022 at 3:18 PM Peter Stahlecker <peter.stahlec...@gmail.com>
wrote:

> I am playing around with an ellipse, which rotates in 3D.
> In its own coordinate system A, its equation of course is
>
> x**2/a**2 + y**2/b**2 + z**2/c**2 = 1
>
> A rotates relative to N, the generalized coordinates are q1, q2, q3,
>  dq1/dt = u1, etc.
> I express the rotated ellipse in N, by using A.variable_map(N), now the
> coordinates are, say, N_x, N_y, N_z.
> Using sympy.solve I solve the ellipse equation for N_y,  I get two
> solutions, of which I take the one I need, so, say, I get
> N_y = f(N_x, N_z, q1, d2, d3, a, b, c,…)
> I want the speed of N_y, so I write:
>
> Speed_N_y = f(…..).diff(t)
>
> Now my problem starts:
> In Speed_N_y,  there are terms like Derivative(q1(t), t), and same for q2,
> q3.
> Of course, these terms are u1, u2, u3, but I cannot find a way to replace
> Derivative(q1(t), t) with u1, etc.
> I tried Speed_N_y.subs({Derivative(q1(t), t): u2})  but this did not work.
> I tried Speed_N_y.subs({q1.diff(t): u1}) also this did not work.
> I also tried to get rid of these Derivative terms by writing
> NY_lam = lambdify( …, Speed_N_y, {‚Derivative(q1(t), t)‘: u1})
> This did not give an error - but also did not accomplish anything.
>
> Of course, when I try to lambdify my Speed_N_y and then try to evaluate it
> numerically the problems come up, as this Derivative(q1(t), t) is unknown.
>
> Any help is GREATLY appreciated! Thanks!
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/243c5c3b-0896-4814-8198-953b001ff950n%40googlegroups.com
> <https://groups.google.com/d/msgid/sympy/243c5c3b-0896-4814-8198-953b001ff950n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAP7f1Ajr1NVDJWWuLRdTpz-2xA-_NTEJrVJCxPk2Y2zoJiqL-Q%40mail.gmail.com.

Reply via email to