Post Reply 
Does Prime support multistatement.......
10-30-2015, 05:03 PM (This post was last modified: 10-30-2015 05:22 PM by Han.)
Post: #4
RE: Does Prime support multistatement.......
(10-29-2015 10:21 PM)toshk Wrote:  say you want to know iterations (gauss-seidel method) of a function when you press enter each time .....without writing a program/codes. doable In Casio Fx.2....wondering in Hp prime.

Edit: the method below is an example of Jacobi iterations

Here's an example of Jacobi iterations, which is very similar to Gauss-Seidel:

Suppose you wish to solve the system:
\[
\begin{array}{rrrrcr}
10x_1 & -x_2 & + 2x_3 & & = & 6\\
-x_1 & + 11x_2 & -x_3 & +3x_4 & = & 25\\
2x_1 & - x_2 & +10x_3 & -x_4 & = & -11\\
& 3x_2 & -x_3 & +8x_4 & = & 15
\end{array}
\]

Solving for \( x_i \) in the i-th equation:
\[
\begin{array}{rcrrrrr}
x_1 & = & & \frac{1}{10}x_2 & -\frac{1}{5}x_3 & & \frac{3}{5}\\
x_2 & = & \frac{1}{11}x_1 & & \frac{1}{11}x_3 & -\frac{3}{11}x_4 & \frac{25}{11} \\
x_3 & = & -\frac{1}{5}x_1 & \frac{1}{10}x_2 & & \frac{1}{10}x_4 & -\frac{11}{10} \\
x_4 & = & & -\frac{3}{8}x_2 & \frac{1}{8}x_3 & & \frac{15}{8}
\end{array}
\]
Enter the following matrix into M1 using the matrix editor:

\[ \left[ \begin{array}{rrrrr}
0 & \frac{1}{10} & -\frac{1}{5} & 0 & \frac{3}{5}\\
\frac{1}{11} & 0 & \frac{1}{11} & -\frac{3}{11} & \frac{25}{11} \\
-\frac{1}{5} & \frac{1}{10} & 0 & \frac{1}{10} & -\frac{11}{10} \\
0 & -\frac{3}{8} & \frac{1}{8} & 0 & \frac{15}{8}\\
0 & 0 & 0 & 0 & 1
\end{array} \right] \]

Row i corresponds to the coefficients after solving for variable i in the i-the equation. The last row (all 0's and a 1 at the far right) is necessary in order for us to iterate using only the ENTER key. This system has solution (1,2,-1,1). In the Jacobi method, we start with an initial guess \( \langle x_1^{(0)}, x_2^{(0)}, x_3^{(0)}, x_4^{(0)} \rangle^T \) and substitute into the variables; this is equivalent to multiplying the matrix above by \( \langle x_1^{(0)}, x_2^{(0)}, x_3^{(0)}, x_4^{(0)}, 1 \rangle^T \). If we did not have the final row in the matrix above (call this matrix \( \overline{M1} \)), then
\[ \overline{M1} \cdot \langle x_1^{(0)}, x_2^{(0)}, x_3^{(0)}, x_4^{(0)}, 1 \rangle^T
= \langle x_1^{(1)}, x_2^{(1)}, x_3^{(1)}, x_4^{(1)} \rangle^T \]
However, we want the result of this multiplication to have the same form as our initial guess so that we can simply iterate with the ENTER key. So this is the reason for the final row in the matrix above. Note that
\[M1 \cdot \langle x_1^{(0)}, x_2^{(0)}, x_3^{(0)}, x_4^{(0)}, 1 \rangle^T
= \langle x_1^{(1)}, x_2^{(1)}, x_3^{(1)}, x_4^{(1)}, 1 \rangle^T \]

With M1 entered as shown above, here's how to iterate using only the ENTER key. Type:

[0,0,0,0,1] ENTER

This puts the initial guess of (0,0,0,0) into Ans. Now type:

M1*Ans ENTER

to get the first iteration [.6, 2.2727272727273, -1.1, 1.875, 1], and continue pressing ENTER to get the subsequent iterations until you finally see [1, 2, -1, 1, 1]. Remember that the last entry is just a "dummy" entry so that the solution is (1,2,-1,1). (For those wondering, we should have technically written our vector as a column vector, but it appears the Prime allows one to use row vectors and smartly interprets them as column vectors! This, of course, would not work for a row matrix, though)

The Gauss-Seidel method uses the next iteration for the lower triangular portion of the matrix M1. I'm curious how this could be done on the Casio without using a program.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Does Prime support multistatement....... - Han - 10-30-2015 05:03 PM



User(s) browsing this thread: 3 Guest(s)