Thanks very much Peter.
I hope I'm not making an error but would welcome you finding one if I am. I'm getting the same error in tutorial examples so suspect it's an error with a new version of sympy or python, or something specific to my setup. I'm using python 3.8 and sympy 1.8. I get the same error on 2 different machines although the same versions of sympy/python.
Code is below. It's when executing the final line that the error comes up - everything else is fine. Thanks again.
_____________________________________
import sympy as sm
import sympy.physics.mechanics as me
## REFERENCE FRAMES
A = me.ReferenceFrame("A") # earth reference frame
P1 = me.ReferenceFrame("P1") # 1st pendulum arm reference frame
P2 = me.ReferenceFrame("P2") # 2nd pendulum arm reference frame
## ORIENTATION
theta1, theta2 = me.dynamicsymbols("theta1 theta2") # generalised coordinates
P1.orient(A, "Axis", (theta1, A.z))
P2.orient(P1, "Axis", (theta2, P1.z))
## KINEMATICS
### Points and Locations
m1, m2, L1, L2 = sm.symbols("m1 m2 L1 L2")
O = me.Point("O")
p1 = me.Point("p1")
p2 = me.Point("p2")
p1.set_pos(O, L1 * P1.x)
p2.set_pos(p1, L2 * P2.x)
### Kinematical Differential Equations
omega1, omega2 = me.dynamicsymbols("omega1 omega2")
kinematical_differential_equations = [omega1 - theta1.diff(),
omega2 - theta2.diff()]
### Angular Velocities
P1.set_ang_vel(A, omega1 * A.z)
P2.set_ang_vel(P1, omega1 * P1.z)
### Linear Velocities
O.set_vel(A, 0) # point O has zero velocity
p1.v2pt_theory(O, A, P1)
p2.v2pt_theory(p1, A, P2)
## KINETICS
g = sm.symbols("g")
F_grav_1 = m1 * g * A.x
F_grav_2 = m2 * g * A.x
B1 = me.Particle("B1", p1, m1)
B2 = me.Particle("B2", p2, m2)
## EQUATIONS OF MOTION
coordinates = [theta1, theta2]
speeds = [omega1, omega2]
loads = [F_grav_1, F_grav_2]
bodies = [B1, B2]
### Kane's Method
kane = me.KanesMethod(A, coordinates, speeds, kinematical_differential_equations)
fr, frstar = kane.kanes_equations(loads, bodies)
_________________________________________