Rank: Advanced Member Groups: Registered
Joined: 30/03/2011(UTC) Posts: 393
Was thanked: 132 time(s) in 113 post(s)
|
What am I doing wrong ? Shouldn't the last two values be equal ? Besides, r^65 gives different values depending on decimal places configured in option menu r^65=64.992 (3 decimal places) r^65=64.9994 (4 deccimal places) third decimal isn't the same!! Open in SMath Cloud
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 09/01/2010(UTC) Posts: 102 Location: Oregon, USA Was thanked: 5 time(s) in 5 post(s)
|
I agree, there does appear to be a problem with the way SMath is calculating powers. Here is the same calculation performed with the number of decimal places set to the maximum: and performed with the number of decimal places set to 3: Thus, when the 5th power of the results are calculated, the answer should be equal out to the 10th decimal place. The remaining difference would be roundoff error between the different numerical algorithms used in the polyroots and solve functions. I would think that Smath should pass results to all subsequent calculations with the maximum possible precision and the round only the DISPLAYED results to the number of decimal places specified in the "options" dialog. Edited by user 25 April 2011 19:48:35(UTC)
| Reason: Not specified |
Will Massie Mechanical Engineer Oregon, USA |
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Hello, Will is right. The results of solve() function depend on the number of displayed decimals. In general, SMath does not have the option for setting the calculating precision with the applied numerical functions. I think that Will is using 0.89 version. Here is the same example with 0.89.8 version r←solve(65-x^5,x)r=2.304r^5=64.917and r=2.30453161980214r^5=64.9999999999999It seems that something has been changed in between. My advice is to use the four argument solve() function, whenever posible. Here it is: r←solve(65-x^5,x,2,3)r=2.305r^5=65Pay attention that solve() will sometimes fail in spite of quite good searching range given. Some playing with the range (third and fourth argument) might be needed. Regarding the nonlinear equations, one can use roots() as well. Here is the same example solved with roots(): r←roots(65-x^5,x)Three decimal places: r=2.305r^5=65Fifteen decimal places: r=2.30453161980214r^5=64.9999999999999Sometimes a three argument roots() version might be more appropriate (if the two argument roots() fails) r←roots(65-x^5,x,2)r=2.305r^5=65 Regards, Radovan Edited by user 26 April 2011 10:45:11(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.