Solve linear equations
To solve 4 z  =  cos2(t)  +  9 sin2(t) for z, type
Variable z Solve( 4*z = cos(t)^2 + 9*sin(t)^2, z )
The response to this Solve command is
-> z = 0.25 + 2*sin(t)^2

Note: To solve the quadratic equation a z2  +  b z  +  c  =  0 , type
Constant a, b, c zSoln = SolveQuadratic( a*z^2 + b*z + c = 0, z )
The response to this Solve command is
-> zSoln[1] = -0.5*(b+sqrt(b^2-4*a*c))/a -> zSoln[2] = -0.5*(b-sqrt(b^2-4*a*c))/a

To symbolically solve the set of algebraic equations shown below (which are linear in x and y), type
Variable x, y Eqn[1] = 2*x + 3*y - sin(t) Eqn[2] = 4*x + 5*y - cos(t) Solve( Eqn = 0, x, y )
2 x + 3 y  =  sin(t)
4 x + 5 y  =  cos(t)
The response to this Solve command is
-> x = 1.5*cos(t) - 2.5*sin(t) -> y = 2*sin(t) - cos(t)
To save commands (for subsequent re-use) or commands/responses, type
Save MGSolveLinearEqns.txt % Save commands. Save MGSolveLinearEqns.html % Save commands and responses.
Other MotionGenesis™ Get Started exercises
Advanced: Auto-generate MATLAB® C, Fortran, etc., codes to solve linear equations.