Skip to main content
1-Visitor
March 26, 2018
Solved

Problem of construction of the Gauss-Seidel Mathcad Operator for the solution of a linear systems

  • March 26, 2018
  • 4 replies
  • 18920 views

I cannot make to work the algorithm of the attached file containing Gauss-Seidel Operator for linear systems. Can someone give an advice, please? I attached it.

Best answer by Werner_E

Luc's Mathcad 11 (which uses Maple for symbolics) can expand that expression, but Mathcad 15 (and 14) and also Prime use Mupad for symbolics and would refuse to display the result. Don't think that this is due to the symbolic engine but rather a design change in Mathcad itself. Somebody at Mathsoft probably thought that it would be a good idea not to let a symbolic result spread some pages widths - sorry guy, but it was not a good idea.

While MC13 still uses Maple (which is far superior over MuPad) it also had some severe deficits. Thats the reason many consider Mathcad11 as the best version ever. Alas, times go by and from todays point of view its probably MC15 to favor.

 

4 replies

23-Emerald I
March 26, 2018

For starters:

  • The keystroke for a range variable is a semicolon (;) not two periods (..)  Mathcad will show two periods, but it won't understand them.
  • "break" is a programming key word, it cannot be typed.
  • If you want a literal subscript in a variable (in version 15) you type a decimal (x.old).  An array subscript ([) will have Mathcad declaring an undefined variable.
  • What is this?
  • Capture.PNG

 

tubar1-VisitorAuthor
1-Visitor
March 26, 2018

Yes, just on that expression is a problem. I wanted to write inside the Sum operator the below equation but it is impossible because appears automatically a void space before "if" that i dont understand why.

 

equation of iteration.png

25-Diamond I
March 26, 2018

On point, additionally to what Fred had already said:

When taking the absolute value of a variable or an expression, Mathcad often can't know if you really mean the absolute value or if you want to take the determinant of a square matrix.

Rightclick at your absolute values and tell Mathcad what your intention is:

Bild.png

 

Concerning your confusion about the "if".

Mathcad offers two of them.

One is the programming if-statement which you chose via the programming palette or its keyboard short cut.

The second is the if-function,

The latter is what you want to use here. this time you simple type "if" and don't chose from the palette.

Nevertheless - when I correct all those errors, i ran into a divison by zero error. You may want to look over it again.

Bild1.png

 

tubar1-VisitorAuthor
1-Visitor
March 26, 2018

Yes, typing directly the command "if" it is allowed the trick. But the issue remains unsolved as we still dont have the solution through Gauss-Seidel Method.

25-Diamond I
March 26, 2018

It looks like you are just retyping a program from a print of a Mathcad sheet.

So check your sheet for typos and keep in mind that there is a big difference between vector indices and literal indices (as you would use for x.old).

23-Emerald IV
March 27, 2018

I suppose you're not interested in the simple solution: let Mathcad do the work.

LM_20180327_SolveVector1.png

 

Some usage examples:

LM_20180327_SolveVector2.png

 

Success!
Luc

21-Topaz II
April 3, 2018

gssj4.jpgI have adapted the program to the case of any origin. It is known that convergence occurs with dominant diagonal matrices and for symmetric and positive definite matrices.

25-Diamond I
April 3, 2018

This new approach suffers from the same problem as the OPs variant.

The algorithm works if the diagonal elements are large and it works guaranteed if the matrix is diagonally dominant like your second example. Unfortunately its not always possible to rearrange the rows or columns easily in such a way that the matrix would be suitable for this algorithm.

And Applying more work in changing the system/matrix would mean a similar effort than solving the system exactly via Gauß or similar.

Bild.png

21-Topaz II
April 3, 2018

gssj5.jpg