The sympy.srepr() function can help debug things, as it shows the "true" form of the expression. Maybe a variable is printing differently than what it is.
Jason moorepants.info +01 530-601-9791 On Mon, Mar 7, 2022 at 1:23 PM Peter Stahlecker <[email protected]> wrote: > I tried on a 'small' example, and N_y.suns({sm.Derivative(q1, t): u1}) > worked just fine !! > No idea, what is going on. > > Am So., 6. März 2022 um 15:18 Uhr schrieb Peter Stahlecker < > [email protected]>: > >> 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 [email protected]. >> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CABKqA0aM60dpNsmJHn70Qsb8BMTceoeVz0ysSS09HTwgnTuMbQ%40mail.gmail.com > <https://groups.google.com/d/msgid/sympy/CABKqA0aM60dpNsmJHn70Qsb8BMTceoeVz0ysSS09HTwgnTuMbQ%40mail.gmail.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAP7f1Ah5A_T1uZE5ECGo0eecEsSURd5o7Wr9c23QLDqROXipUA%40mail.gmail.com.
