Skip to main content
1-Visitor
July 21, 2020
Question

Fixed-Point Iteration for nonlinear systems of equations - my Mathcad alghoritm doesn't work

  • July 21, 2020
  • 1 reply
  • 25038 views

Fixed-Point Iteration for nonlinear systems of equations - my Mathcad alghoritm doesn't work

 

Hello,

I try to make my Mathcad alghoritm to work for a nonlinear system by using Fixed-Point Iteration .  Unfortunately still I cannot get the results. Something is missing in my script. I attached my Mathcad file.

 

The results whould look finally like this  (I obtained it in Excel in order to compare the results if possible):

It     xold     yold    x              y      errx         erry    errf10    errf20
-----------------------------------------------
1 2.0000 4.0000 1.4142 6.0828 0.5858 2.0828 0.6023 23.7569
2 1.4142 6.0828 1.6132 7.3348 0.1990 1.2520 3.2299 9.4517
3 1.6132 7.3348 2.4150 6.9238 0.8018 0.4109 4.8888 38.8502
4 2.4150 6.9238 3.2743 5.6438 0.8593 1.2800 1.7585 28.6511
5 3.2743 5.6438 3.5326 4.8065 0.2583 0.8373 1.5000 6.8054
6 3.5326 4.8065 3.3135 4.6017 0.2191 0.2048 1.7316 4.4348
7 3.3135 4.6017 3.0410 4.7449 0.2725 0.1432 0.8185 6.2781
8 3.0410 4.7449 2.9034 4.9577 0.1377 0.2128 0.0356 3.5969
9 2.9034 4.9577 2.8972 5.0811 0.0061 0.1234 0.3272 0.2816
10 2.8972 5.0811 2.9532 5.0907 0.0559 0.0096 0.3124 1.4396
11 2.9532 5.0907 3.0056 5.0425 0.0524 0.0481 0.1223 1.3810
12 3.0056 5.0425 3.0258 4.9968 0.0203 0.0458 0.0363 0.5519
13 3.0258 4.9968 3.0198 4.9785 0.0060 0.0183 0.0852 0.1304
14 3.0198 4.9785 3.0057 4.9828 0.0141 0.0043 0.0574 0.3554
15 3.0057 4.9828 2.9962 4.9947 0.0096 0.0119 0.0121 0.2503
16 2.9962 4.9947 2.9941 5.0030 0.0020 0.0084 0.0149 0.0590
17 2.9941 5.0030 2.9966 5.0050 0.0025 0.0020 0.0184 0.0604
18 2.9966 5.0050 2.9997 5.0030 0.0031 0.0020 0.0093 0.0786
19 2.9997 5.0030 3.0012 5.0004 0.0015 0.0026 0.0001 0.0413
20 3.0012 5.0004 3.0012 4.9990 0.0000 0.0014 0.0042 0.0008
21 3.0012 4.9990 3.0005 4.9990 0.0007 0.0000 0.0036 0.0176

 

tubar_0-1595371104374.png

 

 

1 reply

23-Emerald IV
July 23, 2020

So your iteration attempts to solve:

LucMeekes_0-1595525864104.png

That's a set of equations with the following (approximate) solutions:

LucMeekes_1-1595525928226.png

The problems with your program are due to the fact that the augment() function (of the last statement) needs all its parameters to be vectors.

You have in there x and y, which are vectors (indexed using it), but it, errx and erry are simple scalar variables.

Apparently you want the iteration number, and the progression of error in your table, so you need to make those variables vectors, have them also indexed by it, potentially. Well you shouldn't index it with it, better create a new vector to hold the progressive it values. How about its  ?

That gives:

LucMeekes_2-1595526320448.png

Not quite the result you expected. But at least the error is gone.

Now you find out why nothing is happening after the first iteration.

 

Success!
Luc

25-Diamond I
July 23, 2020

Now you find out why nothing is happening after the first iteration.


Werner_E_0-1595528685813.png

 

o != 0

23-Emerald IV
July 23, 2020

I was afraid of making that error, and I still did.

But correcting that doesn't help:

LucMeekes_0-1595533308199.png

Luc