MaplePortal/SolveEquations - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : MaplePortal/SolveEquations

 Solve Equations Symbolically & Numerically

 Introduction

These are the position constraints from the multibody analysis of a double pendulum

 > $\mathrm{posCons}≔\left[\begin{array}{c}\mathrm{cos}{}\left(\mathrm{θ__1}\right)\mathrm{Tx}+\mathrm{sin}{}\left(\mathrm{θ__2}\right)+\mathrm{sin}{}\left(\mathrm{θ__1}\right)\mathrm{Ty}\\ -\mathrm{sin}{}\left(\mathrm{θ__1}\right)\mathrm{Tx}-1-\mathrm{cos}{}\left(\mathrm{θ__2}\right)+\mathrm{cos}{}\left(\mathrm{θ__1}\right)\mathrm{Ty}\end{array}\right]:$

 Symbolic Solution

We now symbolically solve the equations for the joint angles with solve

 >
 ${\mathrm{sol}}{≔}\left\{\mathrm{θ__1}{=}{\mathrm{arctan}}{}\left(\frac{{-}{{\mathrm{Tx}}}^{{2}}{-}{{\mathrm{Ty}}}^{{2}}{+}\frac{\left({{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{+}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}\right){}{\mathrm{Ty}}}{{{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}}}{{\mathrm{Tx}}}{,}\frac{{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{+}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}}{{{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}}\right){,}\mathrm{θ__2}{=}{\mathrm{arctan}}{}\left(\frac{\left({-}{2}{}{{\mathrm{Tx}}}^{{2}}{-}{2}{}{{\mathrm{Ty}}}^{{2}}\right){}\left({{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{+}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}\right)}{{4}{}{\mathrm{Tx}}{}\left({{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}\right)}{+}\frac{{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{+}{{\mathrm{Ty}}}^{{3}}}{{2}{}{\mathrm{Tx}}}{,}\frac{{{\mathrm{Tx}}}^{{2}}}{{2}}{+}\frac{{{\mathrm{Ty}}}^{{2}}}{{2}}{-}{1}\right)\right\}{,}\left\{\mathrm{θ__1}{=}{\mathrm{arctan}}{}\left(\frac{{-}{{\mathrm{Tx}}}^{{2}}{-}{{\mathrm{Ty}}}^{{2}}{-}\frac{\left({-}{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{-}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}\right){}{\mathrm{Ty}}}{{{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}}}{{2}{}{\mathrm{Tx}}}{,}{-}\frac{{-}{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{-}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}}{{2}{}\left({{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}\right)}\right){,}\mathrm{θ__2}{=}{\mathrm{arctan}}{}\left({-}\frac{\left({-}{2}{}{{\mathrm{Tx}}}^{{2}}{-}{2}{}{{\mathrm{Ty}}}^{{2}}\right){}\left({-}{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{-}{{\mathrm{Ty}}}^{{3}}{+}\sqrt{{-}{{\mathrm{Tx}}}^{{6}}{-}{2}{}{{\mathrm{Tx}}}^{{4}}{}{{\mathrm{Ty}}}^{{2}}{-}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{4}}{+}{4}{}{{\mathrm{Tx}}}^{{2}}{}{{\mathrm{Ty}}}^{{2}}}\right)}{{4}{}{\mathrm{Tx}}{}\left({{\mathrm{Tx}}}^{{2}}{+}{{\mathrm{Ty}}}^{{2}}\right)}{+}\frac{{{\mathrm{Tx}}}^{{2}}{}{\mathrm{Ty}}{+}{{\mathrm{Ty}}}^{{3}}}{{2}{}{\mathrm{Tx}}}{,}\frac{{{\mathrm{Tx}}}^{{2}}}{{2}}{+}\frac{{{\mathrm{Ty}}}^{{2}}}{{2}}{-}{1}\right)\right\}$ (1)

 Numeric Solution

We now numerically solve the equations for the joint angles with fsolve.

 > $\mathrm{posCons2}≔\mathrm{eval}\left(\mathrm{posCons},\left[\mathrm{Tx}=0.5,\mathrm{Ty}=0.5\right]\right)$
 ${\mathrm{posCons2}}{≔}\left[\begin{array}{c}{0.5}{}{\mathrm{cos}}{}\left(\mathrm{θ__1}\right){+}{\mathrm{sin}}{}\left(\mathrm{θ__2}\right){+}{0.5}{}{\mathrm{sin}}{}\left(\mathrm{θ__1}\right)\\ {-}{0.5}{}{\mathrm{sin}}{}\left(\mathrm{θ__1}\right){-}{1}{-}{\mathrm{cos}}{}\left(\mathrm{θ__2}\right){+}{0.5}{}{\mathrm{cos}}{}\left(\mathrm{θ__1}\right)\end{array}\right]$ (2)
 > $\mathrm{theta3_sol}≔\mathrm{fsolve}\left(\left\{\mathrm{posCons2}\left[1\right],\mathrm{posCons2}\left[2\right]\right\},\left\{\mathrm{θ__1}=0..2\cdot \mathrm{Pi},\mathrm{θ__2}=0..2\cdot \mathrm{Pi}\right\}\right)$
 ${\mathrm{theta3_sol}}{≔}\left\{\mathrm{θ__1}{=}{4.288357941}{,}\mathrm{θ__2}{=}{2.418858406}\right\}$ (3)
 >

 Applications PV Diode Parameter Estimation Flow through an Expansion Valve