Professional Documents
Culture Documents
X2 + Y2 = 13
X+ Y=5
A second example:
This solution can be interpreted as: x = z – 9 and y = -(2*z-15). The term @1 represents a
parameter that can be replaced by any value. Thus, the solution above represents a family of
parametric solutions.
For the next example, we repeat the command above but using two unknowns only:
For the next example, we’ll create two equations (using, for example, the equation writer
introduced in Exercise 1), and store them into variables e1 and e2, as shown below:
These are the equations governing energy and uniform flow (Manning’s equation) at the
entrance from a reservoir to an open channel of rectangular cross-section. Typically the
geometry of the section (b = width), the slope of the channel bed (s), the Manning’s resistance
coefficient (n), the available energy head (h), the coefficient of Manning’s equation (c = 1, for
SI, and c = 1.486 for ES), and the acceleration of gravity (g) are known. The solution of the
simultaneous equation is the pair {q,y}, where q is the flow discharge, and y is the flow depth.
To show a solution using function solve, we first need to provide values to the known variables.
Thus, let’s use: b = 2.5 ft, s = 0.0001, n = 0.012, h = 4 ft, c = 1.486, and g = 32.2 ft/s2. We
need to store these values in the corresponding variables, i.e., 2.5 [STO] b [ENTER] 0.0001
[STO] s [ENTER] etc., as shown below:
To build the solution, type e1[ENTER] and e2 [ENTER] to list the resulting equations, i.e.,
Using the CUT and PASTE functions, put together the command:
i.e., cut and copy the equations shown in the screen above into the solve command. After
pressing [ENTER], you get the following solution (after about 30 seconds):
Note: Once values are given the known variables, the equations stored in variables e1 and e2
will be evaluated every time you invoke their name, as shown in the screen above. To recover
the original equations, you need to delete variables c, n, h, s, b, and g. This can be easily
accomplished by using [2nd][F1] (i.e., F6) and selecting 1: Clear a-z, then pressing [ENTER]. If
you now invoke variables e1 and e2 you will have the original equations. To solve a different
problems, store new values of c, n, h, s, b and g, and repeat the procedure shown above.
Exercise:
Solve the problem of the entrance to a trapezoidal channel from a reservoir for which the
equations are:
q2
h= y+
2 g ((b + zy ) y )
2
c ((b + zy ) y ) 4 / 3
q= ⋅ ⋅ s
n (b + 2 y 1 + z 2 ) 2 / 3
Solve the simultaneous equations for h = 4 ft, g = 32.2 ft/s2, b = 2.5 ft, z = 0.75, n = 0.012, s =
0.00001, and c = 1.486.
Note:
An alternative way to solve this system is to solve for q from the first equation, i.e.,
q = 2 g ((b + zy ) y ) 2 (h − y ) = ((b + zy ) y ) 2 g (h − y ) ,
And make it equal to the second equation, resulting in the single equation:
c ((b + zy ) y ) 4 / 3
((b + zy ) y ) 2 g (h − y ) = ⋅ ⋅ s
n (b + 2 y 1 + z 2 ) 2 / 3
which can be solved for y using solve. Once a value for y has been found, the value of q can
be calculated from either equation for q as shown above.
• Press the [APPS] key, select the Text Editor, and press [ENTER]
• Select 3:New…, and press [ENTER]
• Keep Type: as Text, select the Folder: where you want to store the script, and type
the name of the Variable: as twoeq. Press [ENTER].
• As a result you will get a colon and a blinking cursor. First, enter a title to the script
by typing [ALPHA][ALPHA]Two simultaneous eqns [ALPHA][.] [ENTER]
• To type a command line, use [F2][ENTER] (essentially selecting the option 1:Command)
• Continue typing the script to read as follows (press [ENTER] at the end of each line, use
[F2][ENTER] to type command lines):
• To activate the script, first, move to the top of the script, e.g., using [ ♦ ][S]. Then,
press [F2] and select the option 5:Execute to EOF.
As a result, you will see the commands being executed in the HOME screen, and
stopping with the last one with a BUSY message. When this last command is executed,
then the screen will return to the Text Editor screen.
• Press [HOME] to recover the HOME screen, and press [CLEAR] to ensure that the last
command is not repeated (it takes some time to produce a result).
• Press [S] followed by [ ♦ ][S] to move to the first line of the screen. Then, use [T]
to move down the screen to see all the commands and the results.
• The result, as before is y = 3.99519 and q = 5.55836
Having this script you can modified it to solve other problems that use the same equations but
different values, or even different equations. For example, the exercise proposed above can
be solved by modifying the twoeq script, into the following script, which you can save into a
variable called twoeq2. To copy the script follow these instructions:
• Press [2nd][VAR-LINK].
• Select the variable twoeq, and press [F4] to place a check mark by it.
• Press [F1], and select 2: Copy.
• Select a different folder to copy it
• Rename the variable to twoeq2 by using [2nd][VAR-LINK], selecting the copied
variable, then using [F1] and selecting 3:Rename. Then, type twoeq2 in the To: field
• Press [ENTER].
• At this point, you could copy the rename script back to the original folder. If you
decide to do so, use [2nd][VAR-LINK], select the renamed variable, check it with [F4].
Then use [F1], and select 4:Move. Then select the folder where you want to move it
to, and press [ENTER].
Note: in the call to function solve we have included the option y = 3.9 to start the
numerical solution. Since the depth of flow y in this solution must be smaller that the
available energy head (h = 4 ft), a value of y = 3.9 is a good value to get started.
• To activate the script, first, press [APPS], and select Text Editor. Select 1: Current,
and press [ENTER]. Move to the top of the script using [ ♦ ][S]. Then, press [F2] and
select the option 5:Execute to EOF.
Wait until you’re returned to the script.
• Press [HOME] to recover the HOME screen, and press [CLEAR] to ensure that the last
command is not repeated (it takes some time to produce a result).
• Press [S] followed by [ ♦ ][S] to move to the first line of the screen. Then, use [T]
to move down the screen to see all the commands and the results.
• The result, in this case, is y = 3.93552 and q = 43.7214