Contents
Getting Started

Type the following  equations into the Equation Editor window. Each equation must be on a separate line.

5*x - x*x - 6 = 0

x = ?

Alternatively, select the Help|Load Example command; the equations will be copied from the Help screen to the Editor window.

Now select the Solve command.

The display should change to:

Solve has found a value for x which satisfies the first equation. The ? in the second equation has been replaced by the answer: <2.000000000>.

NextTopic


Advanced Topics

See also:

Syntax of Equations

Plotting

Generators

Samples

Advanced Topics:

INIT

Iterations

Accuracy

Numeric Format

Multiple Solutions


Simultaneous Equations

In this example, none of the equations contain only a single unknown:

{sample1.equ}

x = ?

y = ?

sin(x*y) = 0.5

x+0.5 = y

The solver treats all the equations as a set of simultaneous equations and solves them as a group. There are an infinite number of answers; the ones it finds are:

x = <-1.88722138>

y = <-1.38722138>

The solver is much slower at solving simultaneous equations and the methods it can use are more limited.

NextTopic


Output Variables

In the following equations,

x=3

x*x=?

x*x*x=?

the two question marks are Output variables.

Once again, you can select the Help|Load Example command to copy these equations to the Editor window.

When equations are being solved, an Output variable is treated just the same as any other variable but every Output variable counts as a different, unique variable.

The first equation is solved first and the x variable is set to 3.0. The second and third equations can then be solved the first question mark is given the value 9.0 and the second is given the value 27.0.

Once the solver has solved as many of the equations as it can, the values of the '?' variables are displayed. If the absolute value of an Output variable is less than Accuracy then it is printed as zero.

Because Output variables are treated just the same as other variables, it is quite permissble to embed them in equations:

sin(?^2+0.1)=0.4

NextTopic


FOR
FOR Generators

Solve allows you to set a variable to a sequence of values, for instance:

a = for 0 to 3 by 0.5

'a' is set to '0.0', '0.5', '1.0' ... '3.0' using a FOR generator.

{sample2.equ}

a = for 0 to 3 by 0.5

a = ?

b = a*a

b = ?

The equations are solved with 'a' set equal to 0. Then they are solved with 'a=0.5', then with 'a=1' and so on until 'a=3'. At each step the the other equations in the equation list are solved.

The results are displayed in a Table window:

a	b

0.000000000	0.000000000

0.500000000	0.250000000

1.000000000	1.000000000

1.500000000	2.250000000

2.000000000	4.000000000

2.500000000	6.250000000

3.000000000	9.000000000

FOR generators can have either positive or negative BY expressions:

x = for 50 to 1 by -1

The three expressions for the 'from', TO and BY parts of the FOR generator must all be constants; they may not contain variables or other generators.

A FOR generator always generates at least one value, for instance:

a = for 5 to 1 by 1

generates the value 5 then stops.

NextTopic


Syntax
Syntax of Equations

The following meta-symbols are used:

::=	may be replaced by

|	or

{ ... }	optional

[ ... ]	zero or more occurrences of

( ... )	grouping

in this specification of the syntax of equations:

equation ::=	expression = expression

expression ::=	{ - } term [ ( + | - ) term ]

term ::=	power [ ( * | / | \ ) power ]

power ::=	factor [ ^ factor ]

factor ::=	variable

|	INIT ( variable )

|	outputVariable

|	number

|	functionCall

|	( expression )

|	generator

|	IF expression THEN expression ELSE expression

|	ITERATIONS

|	ACCURACY

number ::=	digits

|	{ digits } . { digits }

|	digits E { + | - } digits

|	{ digits } . { digits } E { + | - } digits

generator ::=	FOR constant TO constant BY constant

|	[constant [ , constant ] ]

functionCall ::=	funcName ( expression )

|	PI

|	( MIN | MAX ) ( expression [ , expression ] )

funcName ::=	SIN | COS | TAN | ARCSIN | ARCCOS | ARCTAN

|	DEG | RAD

|	LN | LOG | EXP

|	SQRT

outputVariable ::=	?

|	X_AXIS ( expression , expression , expression { , expression } )

|	Y_AXIS ( expression , expression , expression { , expression } )

|	Z_AXIS ( expression , expression , expression { , expression } )

variable ::=	( A..Z ) [ A..Z | 0..9 | _ ]

Only the first 10 characters of variable names are significant. The case of letters is ignored.

A constant is an expression containing only numbers, operators and function calls.

Blank characters, tabs and comments are ignored.

NextTopic


Comments

When the equations are being parsed, blank characters, tabs and comments are ignored. Blank lines are also ignored.

A comment starts with a '{' character and continues to the end of the line or until the next '}' character. Comments spanning several lines are not allowed.

a= { comment in an equation } 3

a=3 { comment to the end of the line

NextTopic


Function
Function Names

The following functions are available:

sin(expression)	sine: argument in radians

cos(expression)	cosine: argument in radians

tan(expression)	tangent: argument in radians

arcsin(expression)	arcsine: result in radians

arccos(expression)	arccosine: result in radians

arctan(expression)	arctangent: result in radians

deg(expression)	argument in radians, result in degrees

rad(expression)	argument in degrees, result in radians

ln(expression)	natural logarithm

exp(expression)	exponentiation

log(expression)	logarithm to base 10

sqrt(expression)	square root

max(expression,expression, ...)	maximum

min(expression,expression, ...)	minimum

pi	pi

if(expressionA,expressionB,expressionC)

if expressionA < 0 then expressionB else expressionC

NextTopic


Variable Names

Variable names consist of a letter followed by zero or more letters, numbers or underscores. Only the first 10 characters are significant. The case of letters is ignored:

a

is the same as

A

and

This_Is_A_Long_Name

is the same as

this_is_a_

NextTopic


Order of Generators

The following example has two generators and two simultaneous equations:

{sample5.equ}

a = for -2 to 1 by 1

b = for 1 to 3 by 1

x*x+a=0

y*y+b=5

a=?

b=?

x=?

y=?

It produces the following answers

a 	 	b 	 	x 	 	y

-2.00000000	1.000000000	1.414213562	2.000000000

-2.00000000	2.000000000	1.414213562	1.732050807

-2.00000000	3.000000000	1.414213562	1.414213562

-1.00000000	1.000000000	1.000000000	2.000000000

-1.00000000	2.000000000	1.000000000	1.732050807

-1.00000000	3.000000000	1.000000000	1.414213562

0.000000000	1.000000000	0.000000000	2.000000000

0.000000000	2.000000000	0.000000000	1.732050807

0.000000000	3.000000000	0.000000000	1.414213562

1.000000000	1.000000000	?	2.000000000

1.000000000	2.000000000	?	1.732050807

1.000000000	3.000000000	?	1.414213562

Solve has displayed a ? where it has been unable to find a solution.

Note that the a generator generates its first value then b cycles through all its values; the a generator then generates its second value and b cycles through all its values again, and so on.

In general, later generators in the equation list cycle faster than earlier ones.

So in this eaxmple, r cycles fastest, then q then p.

{sample6.equ}

p = for 1 to 2 by 1

q = [1,10,100]

r = for 7 to 6 by -1

p=?

q=?

r=?

p	q	r

1.000000000	1.000000000	7.000000000

1.000000000	1.000000000	6.000000000

1.000000000	10.00000000	7.000000000

1.000000000	10.00000000	6.000000000

1.000000000	100.0000000	7.000000000

1.000000000	100.0000000	6.000000000

2.000000000	1.000000000	7.000000000

2.000000000	1.000000000	6.000000000

2.000000000	10.00000000	7.000000000

2.000000000	10.00000000	6.000000000

2.000000000	100.0000000	7.000000000

2.000000000	100.0000000	6.000000000

NextTopic


Set Generators

What if we want to solve an equation like

sin(x+y) = 2*x

for various values of y, say 0.1, 0.5 and 1.0?

Solve allows you to set a variable to a sequence of values:

{sample3.equ}

y = [0.1, 0.5, 1.0]

sin(x+y) = 2*x

y = ?

x = ?

The values in square brackets are called a 'Set'. The equations are solved with y set equal to 0.1 and the answers are displayed. Then they are solved with y set equal to 0.5 and the new answers displayed. Finally, they are solved with y=1.0.

All three sets of answers cannot be displayed at the same time in the Equation window so a new Table window is created:

A Set generator (or any other generator) is treated as a variable with a known value and can appear anywhere that a variable can:

{sample4.equ}

sin(x+[0.1,0.5,0.7]) = 2*x

x = ?

A FOR generator can be used instead of a Set generator where a set of equally spaced values is required.

When an equation has several solutions, a generator can be used with an INIT to generate a set of initialisation values. You can use Plots to find the approximate locations of the solutions.

NextTopic


Table Window

When a generator is used, several answers will be found. All the answers cannot be displayed at the same time in the Equation window so a Table window is created.

The Table window is a Notepad style editor like the Equation window. You can edit the text in the window and save it to a file.

The Solve and Cancel commands in the Table window work in just the same way as the commands in the Equation window.

A set of equations can specify both Plot windows and a Table window. For instance:

{sample7.equ}

t = for 0 to 2*pi+0.1 by 0.1

sin(t) = x_axis(1,-2,2)

cos(t) = y_axis(1,-2,2)

2*sin(t) = x_axis(11,-2,2)

2*cos(t) = y_axis(11,-2,2)

t= ?

sin(t)=?

cos(t)=?

displays

NextTopic


FOR
FOR Generators

Solve allows you to set a variable to a sequence of values, for instance:

a = for 0 to 3 by 0.5

'a' is set to '0.0', '0.5', '1.0' ... '3.0' using a FOR generator.

{sample2.equ}

a = for 0 to 3 by 0.5

a = ?

b = a*a

b = ?

The equations are solved with 'a' set equal to 0. Then they are solved with 'a=0.5', then with 'a=1' and so on until 'a=3'. At each step the the other equations in the equation list are solved.

The results are displayed in a Table window:

a	b

0.000000000	0.000000000

0.500000000	0.250000000

1.000000000	1.000000000

1.500000000	2.250000000

2.000000000	4.000000000

2.500000000	6.250000000

3.000000000	9.000000000

FOR generators can have either positive or negative BY expressions:

x = for 50 to 1 by -1

The three expressions for the 'from', TO and BY parts of the FOR generator must all be constants; they may not contain variables or other generators.

A FOR generator always generates at least one value, for instance:

a = for 5 to 1 by 1

generates the value 5 then stops.


Line Drawing
When are Lines Drawn

When you use multiple generators, the order of the generators is important. Lets say we wanted a plot of a against sin(a+b) for increasing values of b.

{sample14.equ}

a = for 0 to 5 by 0.1

b = for 0 to 0.5 by 0.1

sin(a+b) = y_axis(1,-1,1)

a = x_axis(1,0,5)

We would expect to get a set of sine waves each offset from the next. Instead, we get

We got the order of the generators wrong, what we should have written is:

{sample15.equ}

b = for 0 to 0.5 by 0.1

a = for 0 to 5 by 0.1

sin(a+b) = y_axis(1,-1,1)

a = x_axis(1,0,5)

How do we know in what order to write the generators? Roughly speaking, the lines will be joined according to the last generator in the equation list.

Imagine that the plotter has a separate pen for each graph in each window. When the equations for a graph are first solved, the pen moves to those coordinates and the pen is put down on the paper.

Each time the equations are solved again, the pen moves in a straight line to the next coordinates then the pen is put down - if the pen was already down then it draws a line.

If any generator finishes its sequence of numbers then the pen is lifted and the next movement of the pen will not draw a line.

As a very simple example, consider

{sample16.equ}

q=for 1 to 10 by 4

p=for 1 to 3 by 1

p+q=x_axis(1,1,15)

1=y_axis(1,0,2)

The pen has been lifted each time the p generator finished its FOR loop.

If the solver fails to find a solution for the equations then the pen is lifted and there will be a gap in the graph. For instance

{sample17.equ}

x=for 0 to 10 by 0.1

y=sin(x)+0.9

x=x_axis(1,0,10)

sqrt(y)=y_axis(1,0,2)

The solver is unable to find solutions when y is negative so the graph has gaps where no solution was found

In a 3D plot, the order of generators controls how the points of a graph are connected. If we swap the order of the generators in this example, the lines of the graph run parallel to either the x-axis or the y-axis:

{sample18.equ}

x = for 0 to 10 by 1

y = for 0 to 10 by 1

x = x_axis(1,0,10)

y = y_axis(1,0,10)

x*(10-x)*y*y*(10-y) = z_axis(1,0,3000)

gives

But swapping the order of the generators gives

y = for 0 to 10 by 1

x = for 0 to 10 by 1

NextTopic


Multiple Generators
Multiple Generators in Plots

Multiple generators can be used to give nested plots. For instance:

{sample13.equ}

p=[-2,-1,2,3]

x=for -10 to 10 by 0.2

x=x_axis(1,-10,10)

x^p=y_axis(1,-10,10)

displays plots of  1/(x^2), 1/x, x^2 and x^3

When a list of equations contains more than one generator, the order in which generators are executed becomes important.

NextTopic


Plot Window
Plot Window Mouse Commands

Clicking on the left mouse button while the cursor in a 2D Plot Window, displays the current cursor position in the top left corner of the window.

It also puts the cursor position into the Windows Clipboard as text. You can now paste this into any other window that will accept text.

In 3D Plot Windows, clicking on the left mouse button defines a straight line in the 3D space which points directly away from the viewpoint.

If you rotate or tilt the graph and click again then you have defined a second 3D straight line.

The 3D point you are trying to indicate should be at the intersection of these two lines.

Of course, there's no guarantee that the two lines intersect so Solve calculates the coordinates of the point which is half way between where the two lines pass closest to each other.

Solve displays these coordinates in the top left corner of the window and puts them into the Windows Clipboard as text.

For instance, here is the plot from

{sample18.equ }

x = for 0 to 10 by 1

y = for 0 to 10 by 1

x = x_axis(1,0,10)

y = y_axis(1,0,10)

x*(10-x)*y*y*(10-y) = z_axis(1,0,3000)

seen from two viewpoints and with the highest peak marked on both graphs:

The coordinates at the top left corner of the first Plot window are meaningless - they have been calculated by combining this mouse click with the line defined by the previous mouse click, which may have been anywhere in the window. Solve always uses the lines defined by the most recent two mouse clicks.

The coordinates in the second Plot Window have been calculated by combining both mouse clicks. They both pointed at the top of the highest peak and Solve tells us that this point is at approximately:

x = 4.9

y = 7.1

z = 3655.5

Presumably, the actual point is above

x = 5

y = 7

and substituting these figures into the equations gives:

z = <3675.000000>

Rather than use the mouse, you can move the cursor by holding down the Control key and pressing the arrow keys. Press the Return key to show the current cursor coordinates and put them into the Clipboard.

NextTopic


Multiple Axes

In some cases, we want to draw two independent plots in one Plot window. For example:

{ example8.equ }

a = for 0 to 5 by 0.1

a = x_axis(1,0.0,5.0)

sin(a) = y_axis(1,-1.0,1.0)

a*2 = x_axis(21,0.0,10.0)

cos(a*2) = y_axis(21,-2,2)

draws

There are two independent sets of axes:

a = x_axis(1,0.0,5.0)

sin(a) = y_axis(1,-1.0,1.0)

and

a*2 = x_axis(21,0.0,10.0)

cos(a*2) = y_axis(21,-2,2)

For the first axes, the plot number is 1 and in the second, it is 21.

The least significant digit specifies in which Window the plot should be drawn - in this case, both plot numbers refer to Window 1. The most significant digit specifies the graph within the window.

So the first axis output variables describe graph 0 in window 1 and the second axis variables describe graph 2 in window 1.

The plot number can range from 0 to 99, so there can be up to 10 graphs in one Plot window.

NextTopic


Coloured Plots

On colour displays, you can use an optional fourth parameter in an axis output variable to specify the colour of the plot. For instance:

{example9.equ}

a = for 0 to 5 by 0.1

a = x_axis(1,0.0,5.0)

sin(a) = y_axis(1,-1.0,1.0,1)

a*2 = x_axis(21,0.0,10.0)

cos(a*2) = y_axis(21,-2,2,2)

Plot 1 is now drawn in light green and plot 21 is drawn in light red.

The following colours are available

0	Black	8	Dark grey

1	Light red	9	Dark red

2	Light green	10	Dark green

3	Yellow	11	Brown

4	Light blue	12	Dark blue

5	Light magenta	13	Dark magenta

6	Light cyan	14	Dark cyan

7	Light grey	15	White

NextTopic


2D Plots

In a list of equations such as:

{sample8.equ}

a = for 0 to 5 by 0.1

sin(a) = y_axis(1,-1.0,1.0)

a = x_axis(1,0.0,5.0)

The x_axis output variable

x_axis(1,0.0,5.0)

specifies three constants: 1, 0.0 and 5.0. The first is the number of the Plot Window in which the graph will appear. There can be up to 10 Plot Windows numbered between 0 and 9.

The second and third constants specify minimum and maximum values of the x-axis.

So the y_axis output variable

y_axis(1,-1.0,1.0)

specifies that the y-axis for plot 1 should run from -1.0 to 1.0.

The x_axis and y_axis output variables together specify that Solve should display this plot:

A plot can have several x- and y-axes:

{sample9.equ}

a = for 0 to 5 by 0.1

sin(a) = y_axis(1,-1,1)

cos(a) = y_axis(1,-1,1)

a = x_axis(1,0,5)

For each value that the generator gives, the solver find solutions for all the equations then, for each x_axis it looks for all the matching y_axis output variables and draws the next part of the graph.

So if there are two x_axis variables and two y_axis variables the four graphs will be plotted as each x_axis is matched with each y_axis

{sample10.equ}

a = for 0 to 2*pi by 0.1

sin(a) = y_axis(1,-1,1)

sin(a*2) = y_axis(1,-1,1)

cos(a) = x_axis(1,-1,1)

cos(a*2) = x_axis(1,-1,1)

In general, you are better off not using multiple x- and y-axes in this way on the same plot. A better tactic is to use two Plot windows

{sample11.equ}

a = for 0 to 2*pi by 0.1

cos(a) = x_axis(1,-1,1)

sin(a*2) = y_axis(1,-1,1)

cos(a*2) = x_axis(2,-1,1)

sin(a) = y_axis(2,-1,1)

The first Plot window contains

and the second contains:

Solve can display several Plot Windows and each window can show several graphs. However, there may not be more than a total of 96 x_axis, y_axis and z_axis output variables.

Multiple generators can be used to give nested plots. When multiple generators are used, the order of the generators controls the connectivity of the graphs.

A graph will show a broken line when no solution could be found.

NextTopic


3D Plots

If a plot has three axes, x_axis, y_axis and z_axis:

{sample18.equ}

x = for 0 to 10 by 1

y = for 0 to 10 by 1

x = x_axis(1,0,10)

y = y_axis(1,0,10)

x*(10-x)*y*y*(10-y) = z_axis(1,0,3000)

then a 3D graph will be displayed

The scroll bars at the edges of the Plot window control the rotation of the graph.

Moving the horizontal scroll bar rotates the graph about the z-axis, while moving the vertical scroll bar tilts the graph towards and away from the viewer.

The graph is redrawn whenever it is rotated or the window is re-sized. Solve stores the coordinates of all the points of the graph and so does not have to solve the equations again whenever the graph is redrawn.

The number of points stored is limited to 65535 or by the total memory available to Windows.

The order of generators controls how the points of a graph are connected.

You can't mix 2D and 3D plots in one Plot window but, of course, you can have several windows, some with 2D plots and some with 3D plots.

Alternatively, you can draw a 2D plot on a plane in a 3D plot, for instance, plot x against y and set the z_axis to a constant:

{sample19.equ}

z=for 0 to 30 by 0.1

x=z*sin(z)

y=z*cos(z)

z*sin(z)=x_axis(1,-30,30)

z*cos(z)=y_axis(1,-30,30)

30-z=z_axis(1,0,30,1)

0=z_axis(1,0,30)

x=x_axis(2,-30,30)

y=y_axis(2,-30,30)

This produced two plots. Plot 1 shows two 3D graphs

in the first, z*sin(z) and z*cos(z) are plotted against 30-z and in the second, z*sin(z) and z*cos(z) are plotted against each other while the z_axis remains zero.

In Plot 2, z*sin(z) and z*cos(z) are plotted against each other as a 2D graph.

A Plot Window is assumed to be 3D if there is a z_axis output variable in the first plot. So in this case:

x_axis(1,...)  y_axis(1,...)  z_axis(1,...)

x_axis(11,...) y_axis(11,...)

Plot Window 1 is 3D. But in this case:

x_axis(1,...)  y_axis(1,...)

x_axis(11,...) y_axis(11,...) z_axis(11,...)

it's 2D and the z_axis is ignored.

NextTopic


Plotting

Solve can draw 2D and 3D graphs of the solutions to equations. For instance, the equations

a = for 0 to 5 by 0.1

sin(a) =?

a = ?

uses a FOR generator to produce a table of the values of sin(a). If we want to plot these, we replace the '?' output variables with axis output variables:

{sample8.equ}

a = for 0 to 5 by 0.1

sin(a) = y_axis(1,-1.0,1.0)

a = x_axis(1,0.0,5.0)

A Plot Window will appear showing the resulting graph

NextTopic


Numeric Format

Numbers printed in tables or on graphs are written with a maximum field width. The Format command sets the Field Width; its default value is 11 characters.

If a number is too large or too small to be represented accurately in that number of characters then it is written in 'Scientific' format, for instance

2000000000000

would be written as

2.00000E+12

If the Always Scientific box in the Format Dialog is checked then all numbers will be written in Scientific format.

NextTopic


Iterations

Solve will stop looking for solution to an equation if it has not found the solution after 'Iteration' attempts. The Iterations menu command sets the value of Iteration; its default value is 200.

Iteration can also be set as an equation:

iterations = expression

This setting overrides the value set by the Options|Iterations command.

NextTopic


Generators
Generators in INITS

An equation such as

sin(x)-0.5=0

has an infinite number of solutions. Here's the graph of sin(x)-0.5, between x=0 and x=10:

there are solutions to sin(x)-0.5=0 near to x=0.5, x=2.6, x=6.8 and x=8.9.

To find the exact value of the solution near x=0.5, we could use an INIT:

init(x)=0.5

and we would get the answer

x=<0.523598775>

to find all of the solutions between x=0 and x=10, we could use an INIT and a generator:

{sample23.equ}

sin(x)-0.5=0

x=?

init(x)=for 0 to 10 by 1

which gives the answer table

x

0.523598775

0.523598775

2.617993878

2.617993878

2.617993878

6.806784082

6.806784082

6.806784082

8.901179185

8.901179185

8.901179185

You can use Plots to find the approximate locations of solutions and use these for initialisation.

NextTopic


System Constants

Solve will stop looking for solution to an equation when the equation equates to within 'Accuracy'. The Accuracy menu command sets the value of Accuracy; its default value is 1E-9.

Accuracy can also be set as an equation:

accuracy = expression

This setting overrides the value set by the Options|Accuracy command.

NextTopic


Initialisation

The following equations have two sets of solutions:

{sample21.equ}

x*x = 2*x + 17

x= ?

They are

x=<-3.24264068>

and

x=<5.242640687>

The solution which the solver finds depends on its initial guess of the value of x.

The solver generates its first initial guess for x which is usually 1.0. If this guess does not lead to a solution then the solver generates a succession of initial guesses until either one leads to a solution or the solver gives up completely.

The initial guesses form the sequence:

1

-1	negate

-2	reciprocal and double

2	negate

0.5	reciprocal

-0.5	negate

-4	reciprocal and double

4	negate

0.25	reciprocal

-0.25	negate

-8	reciprocal and double

8	negate

...

These are alternately positive and negative and alternately get larger and smaller.

In the example above, the initial guess of 1.0 leads to the solution:

x=<-3.24264068>

and the solver stops.

To find the other solution, we must force the solver to use an initial guess somewhere near 5. We do so by adding the line:

init(x) = 5

The solver now finds the answer:

x=<5.242640687>

The solver makes two passes through the equations. On the first pass, it solves all the equations with an INIT in them. On the second pass, it solves the remaining equations and uses the initialisation values as the initial guesses for the variables .

If the solver cannot find a solution using the initialisation value for a variable then it reverts to the sequence of guesses described above.

When an equation has several solutions, a generator can be used with an INIT to generate a set of initialisation values.

Non-linear simultaneous equations can have several solutions, for instance, solving:

{sample22.equ}

x*x+2*x*y=32

y*y+x=y+15

x=?

y=?

gives just one of the solutions

x=<2.923603392>

y=<4.010896838>

to find the other three, you must set various INITs, setting

init(x)=-14

init(y)=6

gives

x=<-14.1047439>

y=<5.918001837>

or setting

init(x)=-3

init(y)=-4

gives

x=<-3.02577347>

y=<-3.77501736>

or setting

init(x)=8

init(y)=-2

gives

x=<8.206913995>

y=<-2.15388130>

When there are two unknowns, you can use Plots to find the approximate locations of solutions and use these for initialisation. But with three or more unknowns, it's more difficult.

NextTopic


Multiple Solutions
Using Plots to Find Multiple Solutions

The following equations have two sets of solutions:

{sample21.equ}

x*x = 2*x + 17

x=?

They are:

x=<5.242640687>

x=<-3.24264068>

We can persuade Solve to find these solutions by using INITs:

init(x)=5	gives	x=<5.123105625>

and

init(x)=-3	gives	x=<-3.12310562>

But how do we know how many solutions there are and what initial value to give x? The best way is to plot x against the difference between the left and right sides of the equation.

Just add a 'y' term to one side of the equation and have a generator for the 'x' term:

{sample24.equ}

x*x = 2*x + 16 +y

x = for -10 to 10 by 1

x = x_axis(0,-10,10)

y = y_axis(0,-50,50)

Now click the mouse with the cursor over where the graph crosses the x-axis. I got

5.149253731

0.986842105

and

-3.24626865

0.986842105

So there are solutions near to 5.1 and -3.2; use these values as initialisations in your original equation.

When an equation has several solutions, The technique is slightly different.

NextTopic


Multiple Solutions
Multiple Solutions to Simultaneous Equations

In the section on simultaneous equations we saw that

{sample22.equ}

x*x+2*x*y=32

y*y+x=y+15

x= ?

y=?

can have several solutions. We can find approximately where they are by plotting the variables for each graph against each other.

To plot the graph for one equation, we can use a generator to produce values for one unknown and plot this against the value that Solve finds for the other unknown.

If we do this for both graphs, we can see that the solutions will be where the two graphs cross. But we can't use the same variables in both equations at the same time.

In this example, we've changed the names of the variables in the second equation from x and y to x1 and y1. Plot 1 shows the graph for the first equation and Plot 11 shows the graph for the second equation

{sample25.equ}

x*x+2*x*y=32

y1*y1+x1=y1+15

z=for -15 to 10 by 0.3

x=z

y1=z

x=x_axis(1,-10,10)

y=y_axis(1,-10,10)

x1=x_axis(11,-10,10)

y1=y_axis(11,-10,10)

The graphs cross in four places. We can use the mouse cursor to find the coordinates then use those values as the initial values in our original equations:

NextTopic


Samples

The distribution disk contains the following sample equation files:

Simple Equations

sample26	non-linear

sample1	simultaneous equations

sample27	non-linear simultaneous equations

solve5    	non-linear simultaneous equations

sample28	simultaneous equations with no solution

solve2    	every function and operator

Initialisation

sample21	simple

sample22	simple

sample23	initialisation and a generator

sample24	using plots to find INITS

sample25	using plots to find INITS

Generators

sample2	For generators

sample3	set generators

sample4	set generators

sample5	order of generators

sample6	order of generators

solve4    	order of generators and newlines in table

2D Plots

sample8	sine wave

sample9	two graphs

sample7	two graphs and a table

sample10	two graphs

sample11	two windows

sample12	two graphs

sample20	two windows

sample13	two generators

sample14	order of generators

sample15	order of generators

sample16	order of generators

sample17	unable to solve

3D Plots

solve6    	simple

sample18	order of generators

sample19	two windows

solve9    	GLASS

solve10	HEXAGON

solve11	PAWN

solve12	VASE

solve13	SHELL

NextTopic