Help please

8 views
Skip to first unread message

muhammad ramadani fatsey

unread,
Nov 5, 2021, 10:00:27 AM11/5/21
to sympy
Traceback (most recent call last): File "/tmp/sessions/c380e6d285d9328d/main.py", line 6, in <module> Eq((r1-r3)((1-cos(theta-phi)* ddotphi-sin(theta-phi)*dotphi**2)-2*(r1-r2)*ddottheta,g*sin(theta)))],[ddottheta,ddotphi])) TypeError: 'Add' object is not callable

what am I missing here?

from sympy import *
a,b,r1, r2, r3, m1,m2,theta,phi,dottheta, dotphi, ddottheta, ddotphi, g=symbols('a b r1 r2 r3 m1 m2 theta phi dottheta dotphi ddottheta ddotphi g')
print(solve([Eq((m1+m2)*(2*(r1-r3)*ddotphi+g*sin(phi))-m2*(r1-r2)*((1-cos(theta-phi))* ddottheta+sin(theta-phi)*dottheta*2),0),
Eq((r1-r3)((1-cos(theta-phi)* ddotphi-sin(theta-phi)*dotphi**2)-2*(r1-r2)*ddottheta,g*sin(theta)))],[ddottheta,ddotphi]))



Matthew Brett

unread,
Nov 5, 2021, 10:18:44 AM11/5/21
to sympy
The best technique is to strip down the problem to the smallest part
that produces the error.

In your case, you include this expression:

Eq((r1-r3)((1-cos(theta-phi)*
ddotphi-sin(theta-phi)*dotphi**2)-2*(r1-r2)*ddottheta,g*sin(theta)))

The (r1-r3) produces an Add object, and the parentheses that follow
try to call that Add object with the value inside the parentheses...

Maybe you meant to multiply like this?

Eq((r1-r3) * (1-cos(theta-phi)*
ddotphi-sin(theta-phi)*dotphi**2)-2*(r1-r2)*ddottheta,g*sin(theta))

Oscar Gustafsson

unread,
Nov 5, 2021, 10:32:22 AM11/5/21
to sy...@googlegroups.com
Should be a * after (r1-r3).

Eq((r1-r3)*((1-cos(theta-phi)* ddotphi-sin(theta-phi)*dotphi**2)-2*(r1-r2)*ddottheta,g*sin(theta)))],[ddottheta,ddotphi]))

BR Oscar

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/72b1f521-8147-4a8a-bcee-201a781dc9fdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages