To numerically solve the equation x^2  cos(x) = 0, type
Variable x
Solve( x^2  cos(x) = 0, x = 0.2 ) % x = 0.2 is a guess.
As graphed to the right, this nonlinear equation has two solutions.
In general, nonlinear equations have an unknown number of solutions (0, 1, 2, 37, ...).
The Solve command frequently converges to a solution close to the starting guess.
If you guess

x = 0.2,

Solve reports

x = 0.8241323

If you guess

x = 9,

Solve reports

x = 0.8241323

To save input (for subsequent reuse) and/or input and output responses, type
Save SolveSampleNonlinearEqn.txt
Save SolveSampleNonlinearEqn.html


Solving sets of nonlinear algebraic equations
Equation for a circle:


x^{2} + y^{2} = 1

Equation for a sine curve:


y = sin(x)

To numerically solve the previous set of nonlinear equations for x and y, type
Note: The arguments x = 3 and
y = 5 are a guess for the solution.
Variable x, y
eqns[1] = x^2 + y^2  1
eqns[2] = y  sin(x)
Solve( eqns = 0, x = 3, y = 5 )


These nonlinear equations have two solutions.
If you guess

x = 3,

y = 5,

Solve reports

x = 0.739085

and y = 0.673612

If you guess

x = 2,

y = 2,

Solve reports

x = 0.739085

and y = 0.673612

To save input (for subsequent reuse) and/or
input and output responses, type
Save SolveSampleNonlinearEqns.txt
Save SolveSampleNonlinearEqns.html
Solving sets of nonlinear algebraic equations with input
Equation for a circle:


x^{2} + y^{2} = R^{2}

Equation for a sine curve:


y = A * sin(x)

To numerically solve the previous set of nonlinear equations for x and y, type
Constant R = 1 meter, A = 1 meter
Variable x, y
Circle = x^2 + y^2  R^2
SineWave = y  A*sin(x)
Solve( [Circle; SineWave] = 0, x = 3, y = 5 )
To save input (for subsequent reuse) and/or
input and output responses, type
Save SolveSampleNonlinearEqnsWithInput.txt
Save SolveSampleNonlinearEqnsWithInput.html


Generating code to solve nonlinear algebraic equations
MotionGenesis produces
highly efficient and
symbolically optimized codes.
This short script
shows how to generate various codes to solve the previous nonlinear equations.
Depending on your license,
these deployable codes are independent of MotionGenesis.
Note: Each code outputs results in the file
CodeSampleNonlinearEqns.1
To save input (for subsequent reuse) and/or
input and output responses, type
Save CodeSampleNonlinearEqns.txt
Save CodeSampleNonlinearEqns.html
