About Simultaneous Equations
Simultaneous equations are relations in which several variables or dimensions must be solved simultaneously.
Consider these rules for creating simultaneous equations:
• You must declare variables used in simultaneous equations in the beginning of the equations. For example, area = 100, as shown in the next example.
• When solving the simultaneous equation, the system returns only one set of results even if more than one solution for the system of equations is possible.
• You can intermix simultaneous equations with single variable relations.
Example: Sample Simultaneous Equations
For example, you have a box of width d1 and height d2 and you want to specify the following conditions:
• The area equals 100
• The perimeter equals 50
You can enter the following simultaneous equations:
SOLVE
d1*d2 = 100
2*(d1+d2) = 50
FOR d1 d2 ...or... FOR d1,d2
All lines between the SOLVE and FOR statements become part of the simultaneous equations. The FOR line lists the variables to be solved. Any variables that appear in the simultaneous equations but not in the FOR list are interpreted as constants.
Alternatively, you can set the same conditions by entering the following simultaneous equations:
area = 100
perimeter = 50
SOLVE
d1*d2 = area
2*(d1 + d2) = perimeter
FOR d1 d2
Tips for creating simultaneous equations:
• Omitting area = 100 in the preceding relation causes an error.
• You can add extra code downstream from simultaneous equations to specify a solution when there is more than one equation. For example, in the preceding examples, the two possible sets of solutions are d1=5, d2=20 and d1=20, d2=5. You can add the constraint d1 <= d2 by adding the following conditional code:
IF d1 > d2
temp = d1
d1 = d2
d2 = temp
ENDIF