Skip to main content
1-Visitor
December 10, 2014
Solved

Divide by zero

  • December 10, 2014
  • 4 replies
  • 4957 views

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

Best answer by Werner_E

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

4 replies

19-Tanzanite
December 10, 2014

See attached.

Alan

23-Emerald V
December 10, 2014

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

1-Visitor
December 10, 2014

Can You solve it with correct guideline

??

Werner_E25-Diamond IAnswer
25-Diamond I
December 10, 2014

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

1-Visitor
December 10, 2014

Please look at this.

1-Visitor
December 10, 2014

This is the guestion in xmcd.

25-Diamond I
December 10, 2014

piotr grobelny wrote:

This is the guestion in xmcd.

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