Have I gone wrong here? (partial differentiation)

63 Views Asked by At

Starting with

$T = \frac{1}{2}M_{w}\dot{x}^{2} + \frac{1}{2}I_{w}\frac{\dot{x}^2}{r^2} + \frac{1}{2}M_{b}((\dot{x} + L\dot{\theta}cos(\theta))^2 + (L\dot{\theta}sin(\theta))^2) + \frac{1}{2}I_{b}\dot{\theta}^{2}$

$V = mgLcos(\theta)$

and using the Lagrange equations

$L = T - V$

$\frac{d}{dt}\frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} = Q$

$\frac{d}{dt}\frac{\partial T}{\partial \dot{q}} - \frac{d}{dt}\frac{\partial V}{\partial \dot{q}} - \frac{\partial T}{\partial q} + \frac{\partial V}{\partial q} = Q$


First considering $x$

$\frac{d}{dt}\frac{\partial T}{\partial \dot{x}} - \frac{d}{dt}\frac{\partial V}{\partial \dot{x}} - \frac{\partial T}{\partial x} + \frac{\partial V}{\partial x} = Q_x$

$\frac{d}{dt}\frac{\partial T}{\partial \dot{x}} = \frac{d}{dt}(M_w\dot{x} + \frac{I_w}{r^2}\dot{x} + \frac{1}{2}M_b2(\dot{x} + L\dot{\theta}cos(\theta)) + 0)$

$ = \frac{d}{dt}(M_w\dot{x} + \frac{I_w}{r^2}\dot{x} + M_b\dot{x} + M_bL\dot{\theta}cos(\theta) + 0)$

$ = M_w\ddot{x} + \frac{I_w}{r^2}\ddot{x} + M_b\ddot{x} + M_bL\ddot{\theta}cos(\theta) - M_bL\dot{\theta}^2sin(\theta)$

$\frac{d}{dt}\frac{\partial V}{\partial \dot{x}} = 0$

$\frac{\partial T}{\partial x} = 0$

$\frac{\partial V}{\partial x} = 0$

so

$Q_x = (M_w\ddot{x} + \frac{I_w}{r^2}\ddot{x} + M_b\ddot{x} + M_bL\ddot{\theta}cos(\theta) - M_bL\dot{\theta}^2sin(\theta)) - 0 - 0 + 0$

$ = M_w\ddot{x} + \frac{I_w}{r^2}\ddot{x} + M_b\ddot{x} + M_bL\ddot{\theta}cos(\theta) - M_bL\dot{\theta}^2sin(\theta)$


Then considering ${\theta}$

$\frac{d}{dt}\frac{\partial T}{\partial \dot{\theta}} - \frac{d}{dt}\frac{\partial V}{\partial \dot{\theta}} - \frac{\partial T}{\partial \theta} + \frac{\partial V}{\partial \theta} = Q_\theta$

$\frac{d}{dt}\frac{\partial T}{\partial \dot{\theta}} = \frac{d}{dt}(0 + 0 + \frac{1}{2}M_b( 2(\dot{x} + L\dot{\theta}cos(\theta))Lcos(\theta) + 2(L\dot{\theta}sin(\theta))Lsin(\theta)) + I_b\dot{\theta})$

$ = \frac{d}{dt}(M_b\dot{x}Lcos(\theta) + M_bL^2\dot{\theta}cos^2(\theta) + M_bL^2\dot{\theta}sin^2(\theta) + I_b\dot{\theta})$

$ = \frac{d}{dt}(M_b\dot{x}Lcos(\theta) + M_bL^2\dot{\theta} + I_b\dot{\theta})$

$ = M_b\ddot{x}Lcos(\theta) - M_b\dot{x}Lsin(\theta)\dot{\theta} + M_bL^2\ddot{\theta} + I_b\ddot{\theta}$

$\frac{d}{dt}\frac{\partial V}{\partial \dot{\theta}} = 0$

$\frac{\partial T}{\partial \theta} = 0 + 0 + \frac{1}{2}M_b(2(\dot{x} + Lcos(\theta)\dot{\theta})(-Lsin(\theta)\dot{\theta}) + 2(Lsin(\theta)\dot{\theta})Lcos(\theta)\dot{\theta}) + 0$

$ = M_b(-\dot{x}Lsin(\theta)\dot{\theta} - L^2\dot{\theta}^2cos(\theta)sin(\theta) + L^2\dot{\theta}^2cos(\theta)sin(\theta))$

$ = -M_b\dot{x}Lsin(\theta)\dot{\theta}$

$\frac{\partial V}{\partial \theta} = -M_bgLsin(\theta)$

so

$Q_\theta = (M_b\ddot{x}Lcos(\theta) - M_b\dot{x}Lsin(\theta)\dot{\theta} + M_bL^2\ddot{\theta} + I_b\ddot{\theta}) - 0 - (-M_b\dot{x}Lsin(\theta)\dot{\theta}) + (-M_bgLsin(\theta))$

$= M_b\ddot{x}Lcos(\theta) + M_bL^2\ddot{\theta} + I_b\ddot{\theta} - M_bgLsin(\theta)$