Solve Equations Symbolically & Numerically
Back to Portal
Introduction
These are the position constraints from the multibody analysis of a double pendulum
posCons≔cosθ__1Tx+sinθ__2+sinθ__1Ty−sinθ__1Tx−1−cosθ__2+cosθ__1Ty:
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+Tx2Ty+Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty2TyTx2+Ty2Tx,Tx2Ty+Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty2Tx2+Ty2,θ__2=arctan−2Tx2−2Ty2Tx2Ty+Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty24TxTx2+Ty2+Tx2Ty+Ty32Tx,Tx22+Ty22−1,θ__1=arctan−Tx2−Ty2−−Tx2Ty−Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty2TyTx2+Ty22Tx,−−Tx2Ty−Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty22Tx2+Ty2,θ__2=arctan−−2Tx2−2Ty2−Tx2Ty−Ty3+−Tx6−2Tx4Ty2−Tx2Ty4+4Tx4+4Tx2Ty24TxTx2+Ty2+Tx2Ty+Ty32Tx,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.5cosθ__1+sinθ__2+0.5sinθ__1−0.5sinθ__1−1−cosθ__2+0.5cosθ__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