```python
import sympy as sm
import sympy.physics.mechanics as me
me.init_vprinting()
```


```python
k, m, l, g = sm.symbols('k, m, l, g')

q1, q2 = me.dynamicsymbols('q1, q2')

u1, u2 = me.dynamicsymbols('u1, u2')
```


```python
N, A, B = sm.symbols('N, A, B', cls=me.ReferenceFrame)
```


```python
O, Ao, Bo = sm.symbols('O, Ao, Bo', cls=me.Point)
```


```python
A.orient_axis(N, q1, N.z)
B.orient_axis(A, q2, A.x)
```


```python
A.set_ang_vel(N, u1*N.z)
B.set_ang_vel(A, u2*A.x)
```


```python
O.set_vel(N, 0)
```


```python
Ao.set_pos(O, l/2*A.x)
Bo.set_pos(O, l*A.x)
```


```python
Ao.v2pt_theory(O, N, A)
```


```python
Bo.v2pt_theory(O, N, A)
```


```python
A.ang_vel_in(N)
```


```python
B.ang_vel_in(N)
```


```python
me.partial_velocity([Ao.vel(N), Bo.vel(N),
                     A.ang_vel_in(N), B.ang_vel_in(N)], [u1, u2], N)
```


```python
v_Ao_1 = Ao.vel(N).diff(u1, N)
v_Ao_2 = Ao.vel(N).diff(u2, N)
v_Bo_1 = Bo.vel(N).diff(u1, N)
v_Bo_2 = Bo.vel(N).diff(u2, N)
w_A_1 = A.ang_vel_in(N).diff(u1, N)
w_A_2 = A.ang_vel_in(N).diff(u2, N)
w_B_1 = B.ang_vel_in(N).diff(u1, N)
w_B_2 = B.ang_vel_in(N).diff(u2, N)
```


```python
R_Ao = m*g*N.x
R_Bo = m*g*N.x
T_A = -q1*k*N.z + q2*k*B.x
T_B = -q2*k*B.x
```


```python
F1 = v_Ao_1.dot(R_Ao) + v_Bo_1.dot(R_Bo) + w_A_1.dot(T_A) + w_B_1.dot(T_B)
F1
```


```python
F2 = v_Ao_2.dot(R_Ao) + v_Bo_2.dot(R_Bo) + w_A_2.dot(T_A) + w_B_2.dot(T_B)
F2
```


```python
Rs_Ao = -m*Ao.acc(N)
Rs_Bo = -m*Bo.acc(N)
```


```python
I = m*l**2/12
I_A_Ao = I*me.outer(A.y, A.y) + I*me.outer(A.z, A.z)
I_B_Bo = I*me.outer(B.x, B.x) + I*me.outer(B.z, B.z)
```


```python
Ts_A = -(A.ang_acc_in(N).dot(I_A_Ao) +
         me.cross(A.ang_vel_in(N), I_A_Ao).dot(A.ang_vel_in(N)))
Ts_B = -(B.ang_acc_in(N).dot(I_B_Bo) +
         me.cross(B.ang_vel_in(N), I_B_Bo).dot(B.ang_vel_in(N)))
```


```python
Fs1 = v_Ao_1.dot(Rs_Ao) + v_Bo_1.dot(Rs_Bo) + w_A_1.dot(Ts_A) + w_B_1.dot(Ts_B)
Fs1
```


```python
Fs2 = v_Ao_2.dot(Rs_Ao) + v_Bo_2.dot(Rs_Bo) + w_A_2.dot(Ts_A) + w_B_2.dot(Ts_B)
Fs2
```


```python
Fr = sm.Matrix([F1, F2])
Fr
```


```python
Frs = sm.Matrix([Fs1, Fs2])
Frs
```


```python

```

67ce7c6565e5bc6a7a53c3570f0084fa88a98571
ipynb
Jupyter Notebook
content/notebooks/generalized-forces.ipynb
moorepants/me41055
5c941d28f6f61fa1a02fbda4772d88010014eec0
CC-BY-4.0
content/notebooks/generalized-forces.ipynb
moorepants/me41055
5c941d28f6f61fa1a02fbda4772d88010014eec0
CC-BY-4.0
2022-01-07T18:05:36.000Z
2022-03-22T15:15:01.000Z
content/notebooks/generalized-forces.ipynb
moorepants/me41055
5c941d28f6f61fa1a02fbda4772d88010014eec0
CC-BY-4.0
2022-01-24T17:18:40.000Z
2022-01-24T17:18:40.000Z
Qwen/Qwen-72B
1. YES
2. YES