saving . . . saved tutorial 15 not working has been deleted. tutorial 15 not working has been Shown .
tutorial 15 not working
Title
Question
<span lang="EN">

http://spoken-tutorial.org/watch/Scilab/Linear%2Bequations%2BGaussian%2BMethods/English/

\r\n

In this tutorial the first loop in the code makes an UT array. Or, at least it's supposed to.

\r\n

Looking at this code using the debugger with breaks set at 32 and 34 I get the following results for the loop indexes: k=1, j=2, i=2 for the first iteration of the code.

\r\n

Line 32 shows the factor, line 34 shows the code to zero out the following columns below the index element.

\r\n

At line 32: factor = A(2,1)/A(1,1) is evaluated at the given index values which is OK. A(1,1) to normalize the row and A(2,1) to get rid of the first col in the following row. That's OK.

\r\n

At line 34 we get A(i,j)=A(i,j)-factor*A(k,j) which resolves to

\r\n

A(2,2)=A(2,2)-factor*A(1,2) using the i, j, k values. Not good!

\r\n

This code should resolve to

\r\n

A(2,1)=A(2,1) - factor * A(1,1)

\r\n

to set A(2,1) to zero, the rest of the loop changes the other elements in this row by the same factor. So this loop is screwed up. If I change the code so A(2,1) is used where it should, the element is now zero, but the code shows an index error when I run it. So I'll have to monkey around with the code to make the UT array, but there is definitely a problem with this example!

\r\n

And the last loop back substitutes to get the solution: I hope the last loop works as I have not tried it yet!

\r\n

I modified the original code to make debugging simpler: I hard wired in the A and b arrays, and deleted the back substitution section, so I can focus only on the UT matrix code.

</span>

Scilab Linear-equations-Gaussian-Methods 11-12 min 50-60 sec 23-06-18, 3:32 a.m. maxcy

Answers:

Log-in to answer to this question.