Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline kilele  
#1 Posted : 24 April 2011 13:44:57(UTC)
kilele


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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline maweilian  
#2 Posted : 25 April 2011 19:19:30(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
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
Offline omorr  
#3 Posted : 26 April 2011 10:23:12(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

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.304
r^5=64.917
and
r=2.30453161980214
r^5=64.9999999999999
It 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.305
r^5=65
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():
r←roots(65-x^5,x)
Three decimal places:
r=2.305
r^5=65
Fifteen decimal places:
r=2.30453161980214
r^5=64.9999999999999
Sometimes a three argument roots() version might be more appropriate (if the two argument roots() fails)
r←roots(65-x^5,x,2)
r=2.305
r^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!"
Users browsing this topic
Guest
Similar Topics
CNC Precision Machining: Everything You Need To Know (Archive)
by Guest 11/05/2022 08:51:25(UTC)
Precision on NonLinear Solvers (Questions)
by Roman2302 09/10/2021 20:51:57(UTC)
Units with high-precision factors in symbolic mode create large fractions (Bugs & Problems)
by lrb2_ 13/09/2021 05:35:59(UTC)
REQ: units, precision, text formating, alignment, print ranges (Feature Requests)
by sinneD 25/03/2011 16:48:36(UTC)
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.