1 страниц (3 вхождений)
precision - Сообщения
#1 Опубликовано: 24.04.2011 06:44:57
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!!
[LIVE width=386 height=543]http://smath.info/live/?file=2675[/LIVE]
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!!
[LIVE width=386 height=543]http://smath.info/live/?file=2675[/LIVE]
#2 Опубликовано: 25.04.2011 12:19:30
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.
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.
Will Massie
Mechanical Engineer
Oregon, USA
#3 Опубликовано: 26.04.2011 03:23:12
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
[MATH=eng]r←solve(65-x^5,x)[/MATH]
[MATH=eng]r=2.304[/MATH]
[MATH=eng]r^5=64.917[/MATH]
and
[MATH=eng]r=2.30453161980214[/MATH]
[MATH=eng]r^5=64.9999999999999[/MATH]
It seems that something has been changed in between. My advice is to use the four argument solve() function, whenever posible. Here it is:
[MATH=eng]r←solve(65-x^5,x,2,3)[/MATH]
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Pay 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():
[MATH=eng]r←roots(65-x^5,x)[/MATH]
Three decimal places:
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Fifteen decimal places:
[MATH=eng]r=2.30453161980214[/MATH]
[MATH=eng]r^5=64.9999999999999[/MATH]
Sometimes a three argument roots() version might be more appropriate (if the two argument roots() fails)
[MATH=eng]r←roots(65-x^5,x,2)[/MATH]
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Regards,
Radovan
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
[MATH=eng]r←solve(65-x^5,x)[/MATH]
[MATH=eng]r=2.304[/MATH]
[MATH=eng]r^5=64.917[/MATH]
and
[MATH=eng]r=2.30453161980214[/MATH]
[MATH=eng]r^5=64.9999999999999[/MATH]
It seems that something has been changed in between. My advice is to use the four argument solve() function, whenever posible. Here it is:
[MATH=eng]r←solve(65-x^5,x,2,3)[/MATH]
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Pay 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():
[MATH=eng]r←roots(65-x^5,x)[/MATH]
Three decimal places:
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Fifteen decimal places:
[MATH=eng]r=2.30453161980214[/MATH]
[MATH=eng]r^5=64.9999999999999[/MATH]
Sometimes a three argument roots() version might be more appropriate (if the two argument roots() fails)
[MATH=eng]r←roots(65-x^5,x,2)[/MATH]
[MATH=eng]r=2.305[/MATH]
[MATH=eng]r^5=65[/MATH]
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 страниц (3 вхождений)
-
Новые сообщения
-
Нет новых сообщений