Solving one nonlinear algebraic equation

To numerically solve the equation    x^2 - cos(x) = 0    for x, type
Note: The argument   x = 0.2   provides a starting guess for the solution.

  Variable  x
  Solve( x^2 - cos(x),  x = 0.2 )
  

Nonlinear equations may have multiple solutions.
The program's solution of   x = 0.8241323   depends on the starting guess.
The program frequently converges to a solution close to the starting guess.

To save input (for subsequent re-use) and/or input and output responses, type
Save   SolveSampleNonlinearEqn.txt
Save   SolveSampleNonlinearEqn.all

MotionGenesis Graph of x^2 - cos(x) versus x



Solving sets of nonlinear algebraic equations

Equations for a circle and sine curve.

x2  +  y2   =   1
y   =   sin(x)

To numerically solve the previous set of nonlinear equations for x and y, type
Note: The arguments   x=3   and   x=5   provide a starting guess for the solution.
Variable  x, y
Zero[1] = x^2 +  y^2  -  1
Zero[2] = y - sin(x)
Solve( Zero, x=3, y=5 )
MotionGenesis Numerical solution for finding the intersection of a circle and sine-wave
These nonlinear equations have two solutions.
The program's solution of   x = 0.739085   and   y = 0.673612   depend on the guess.
The program frequently converges to a solution close to the starting guess.

To save input (for subsequent re-use) and/or input and output responses, type
Save   SolveSampleNonlinearEqns.txt
Save   SolveSampleNonlinearEqns.all



Solving sets of nonlinear algebraic equations with input

x2   +   y2   =   R2
y   =   A * sin(x)

To numerically solve the previous set of nonlinear equations for x and y, type
Note: Numerical values for   A   and   R   are provided in the Input command.
Constant  R, A
Variable  x, y
Zero[1] = x^2 +  y^2  -  R^2
Zero[2] = y - A*sin(x)
Input A=1, R=1
Solve( Zero, x=3, y=5 )

To save input (for subsequent re-use) and/or input and output responses, type
Save   SolveSampleNonlinearEqnsWithInput.txt
Save   SolveSampleNonlinearEqnsWithInput.all

MotionGenesis Numerical solution for finding the intersection of a circle and sine-wave




Generating code to solve nonlinear algebraic equations

MotionGenesis produces highly efficient and symbolically optimized codes.
A simple   command file   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

Code
Command file
Comments
C
CodeSampleNonlinearEqns.c Compile and link source code.
Modify input values in   CodeSampleNonlinearEqns.in
Note: Compiled code optimizes for its processor.
Fortran
CodeSampleNonlinearEqns.f Compile and link source code.
Modify input values in   CodeSampleNonlinearEqns.in
Note: Compiled code optimizes for its processor.
MATLABŪ
CodeSampleNonlinearEqns.m Invoke MATLABŪ and type   load CodeSampleNonlinearEqns
Modify input values in   CodeSampleNonlinearEqns.m
Note: Interpreted .m codes are slower than compiled codes.

To save input (for subsequent re-use) and/or input and output responses, type
Save   CodeSampleNonlinearEqns.txt
Save   CodeSampleNonlinearEqns.all


Copyright (c) 1988-2011. All rights reserved.