Skip to main content
1-Visitor
Dec 10, 2014 1:45 PM UTC
Solved

Divide by zero

Hi

I need help because I can"t solve my task. Please look at this situations. I need solve it very guickly. Thanks for help

Werner_E
Werner_EAnswer
25-Diamond I
Dec 10, 2014 3:37 PM UTC

Do you already know that your function y6 is wrong because you used the wrong value (0) for x[N in your routine X_Gauss()? You have compared to y(x) (the result obtained with lsolve) yourself and must have seen that those two functions are far apart.

See my remarks here http://communities.ptc.com/message/265948#265948

Your new problem may be due to the fact that you try to solve a system consisting of still seven equations but with just six variables, as you are just searching for a polynomial of order 5 now.

lsolve will still handle that kind of systems which are not square, too, but the result may not be satisfactory as the system may not have a solution anyway. So its no surprise that you run into problems using your self made Gauss elimination routines.

Normally you won't be able to find a polynomial of fifth order which runs through seven given points - the best you could get is a close approximation and thats called regression. Is it this you are after? lsolve will get you an approximation here but by far not the best one you can get with a 5th order polynomial. Mathcad has other means to obtain that kind of fits.

Here you have your original data and the results of the sixth and fifth order polynomila compared to each other.

In the plot the difference is hardly seen unless you zoom in.

1.png

12 replies

19-Tanzanite
Dec 10, 2014 2:03 PM UTC

See attached.

Alan

Translate
23-Emerald V
Dec 10, 2014 2:10 PM UTC

Your problem is that the matrix A you use to set B5 only has 6 columns, unlike the A you use to set B6, which has 7 columns. This means that, because you set i to number of rows (-7), B5 has column 6 = all zeros. Hence the divide by zero error.

If you amend this (using B5 = augment(B5,b5) rather than iterating over i) then you hit another problem in El_Gauss because i ranges from 1 to 7 and hence gives a problem with Bj,i when i = 7 because there is no column 7 in B5.

Stuart

Translate
1-Visitor
Dec 10, 2014 2:36 PM UTC

Can You solve it with correct guideline

??

Translate
Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
Dec 10, 2014 3:37 PM UTC

Do you already know that your function y6 is wrong because you used the wrong value (0) for x[N in your routine X_Gauss()? You have compared to y(x) (the result obtained with lsolve) yourself and must have seen that those two functions are far apart.

See my remarks here http://communities.ptc.com/message/265948#265948

Your new problem may be due to the fact that you try to solve a system consisting of still seven equations but with just six variables, as you are just searching for a polynomial of order 5 now.

lsolve will still handle that kind of systems which are not square, too, but the result may not be satisfactory as the system may not have a solution anyway. So its no surprise that you run into problems using your self made Gauss elimination routines.

Normally you won't be able to find a polynomial of fifth order which runs through seven given points - the best you could get is a close approximation and thats called regression. Is it this you are after? lsolve will get you an approximation here but by far not the best one you can get with a 5th order polynomial. Mathcad has other means to obtain that kind of fits.

Here you have your original data and the results of the sixth and fifth order polynomila compared to each other.

In the plot the difference is hardly seen unless you zoom in.

1.png

Translate
1-Visitor
Dec 10, 2014 5:38 PM UTC

Please look at this.

Translate
1-Visitor
Dec 10, 2014 5:43 PM UTC

This is the guestion in xmcd.

Translate
Werner_E
25-Diamond I
Dec 10, 2014 5:48 PM UTC

piotr grobelny wrote:

This is the guestion in xmcd.

I don't see any new question in that file.

Translate