cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Divide by zero

ptc-3682623
12-Amethyst

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

12 REPLIES 12

See attached.

Alan

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

Can You solve it with correct guideline

??

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

Please look at this.

piotr grobelny wrote:

Please look at this.

???

This is the guestion in xmcd.

piotr grobelny wrote:

This is the guestion in xmcd.

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

RichardJ
19-Tanzanite
(To:ptc-3682623)

Do you mean the invalid index error? You have set N equal to the number of rows in B. You have set k to go to N+1, and then you have B[i,k. So the number of columns in B would have to be at least the number of rows + 1, but you have passed the function a square matrix, B5.

could You solve it and show in xmcd??

I know what is it. Number of matrix 7,8

Thanks for help All.

Top Tags