Solve Equations Symbolically & Numerically
Back to Portal
Introduction
These are the position constraints from the multibody analysis of a double pendulum
posCons≔cos⁡θ__1⁢Tx+sin⁡θ__2+sin⁡θ__1⁢Ty−sin⁡θ__1⁢Tx−1−cos⁡θ__2+cos⁡θ__1⁢Ty:
Symbolic Solution
We now symbolically solve the equations for the joint angles with solve
sol ≔ solveposCons1, posCons2, θ__1,θ__2,explicit;
sol≔θ__1=arctan⁡−Tx2−Ty2+Tx2⁢Ty+Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty2⁢TyTx2+Ty2Tx,Tx2⁢Ty+Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty2Tx2+Ty2,θ__2=arctan⁡−2⁢Tx2−2⁢Ty2⁢Tx2⁢Ty+Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty24⁢Tx⁢Tx2+Ty2+Tx2⁢Ty+Ty32⁢Tx,Tx22+Ty22−1,θ__1=arctan⁡−Tx2−Ty2−−Tx2⁢Ty−Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty2⁢TyTx2+Ty22⁢Tx,−−Tx2⁢Ty−Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty22⁢Tx2+Ty2,θ__2=arctan⁡−−2⁢Tx2−2⁢Ty2⁢−Tx2⁢Ty−Ty3+−Tx6−2⁢Tx4⁢Ty2−Tx2⁢Ty4+4⁢Tx4+4⁢Tx2⁢Ty24⁢Tx⁢Tx2+Ty2+Tx2⁢Ty+Ty32⁢Tx,Tx22+Ty22−1
Numeric Solution
We now numerically solve the equations for the joint angles with fsolve.
posCons2≔evalposCons,Tx=0.5,Ty=0.5
posCons2≔0.5⁢cos⁡θ__1+sin⁡θ__2+0.5⁢sin⁡θ__1−0.5⁢sin⁡θ__1−1−cos⁡θ__2+0.5⁢cos⁡θ__1
theta3_sol≔fsolveposCons21,posCons22,θ__1=0..2⋅Pi,θ__2=0..2⋅Pi
theta3_sol≔θ__1=4.288357941,θ__2=2.418858406
Applications
PV Diode Parameter Estimation
Flow through an Expansion Valve
Three Reservoir Problem
Download Help Document