12.1: Given/Find Blocks
- Page ID
- 14985
'given/find' block
We illustrate this through the following example.
Example 12.1.1
Solve: 2 = x4 + 3x2 − 1.
Solution
In the worksheet, the syntax is
given
2 = x4+3x2- 1 (Use ctrl + = for bold symbolic equals sign)
guess
x := 1
x := find(x)
x =
The last line will show x = 0.89 once the equals sign is entered. The line x := find(x) solves for x and then stores it back as the variable x. For full details, the guess of x := 1 provides the “seed” for the Newton-Raphson algorithm (Google it). Try changing the seed value to see what happens. For example, if we start with x := −1 we end up with a different answer, namely x = −0.89.
The given/find process can be extended to solving systems of equations as well as in the next example:
Example 12.1.2
Simultaneously solve a + b = 3, a − b = 4 for a, b.
Solution
In the worksheet, using ctrl + = for bold symbolic equals sign, the syntax is
given
a+b 3
a-b 4
guess
a := 1
b := 1
find(a,b)=
Once, you hit return on the last line, it will become
\[find(a,b)= \begin{pmatrix} 3.5 \\ -0.5 \end{pmatrix}\nonumber\]
The given/find capabilities are not limited to linear equations as can be seen in the next example.
The given/find capabilities are not limited to linear equations as can be seen in the next example.
Example 12.1.3
Simultaneously solve t4+r3 = 1 and r−t2 = −2
Solution
In the worksheet, using ctrl + = for bold symbolic equals sign, the syntax is
given
t4+r3 = 1
r−t2 = −2
guess
r := 1
t := 1
find(r,t)=
Once, you hit return on the last line, it will become
\[find(r,t)= \begin{pmatrix} -0.783 \\ 1.103 \end{pmatrix}\nonumber\]
So, one solution is r = −0.783, t = 1.103. Note that this is not the only solution. Can you change the seed (or “guess”) values to get the rest of the solutions?