Using calculation - solve

Using calculation - solve - I don't get it :) - Messages

#1 Posted: 11/21/2014 1:47:42 PM
ESKDK

ESKDK

0 likes in 7 posts.

Group: User

Hi!

I just tried the solve-function.

sqrt(x)=5 - highlight x and choose calculation - solve

I get the result 25,0000013034682

??

Regards

E
Solve.sm (4 KiB) downloaded 38 time(s).
#2 Posted: 11/21/2014 7:23:02 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Probably you have an high range in your settings (try Tools -> Calculation -> Roots (range))
I get your result with -1000 .. 1000
Simply use a smaller or better range (f.e. in your example you can set the bottom range to 0)
2014-11-21 23_24_11-SMath Studio Desktop - [WriterRegion.sm_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 11/22/2014 3:07:20 AM
ESKDK

ESKDK

0 likes in 7 posts.

Group: User

:d Thanx

That solved my problem - I set the roots (range) to -500;500 and the result is now right.

The strange thing is: If I set the range to -1000;1000 and do a solve(sqrt(x)=5;x), the result is right.

Is there any explanation I could tell my users?

Regards

/E
Solve.sm (13 KiB) downloaded 34 time(s).
#4 Posted: 11/22/2014 3:36:42 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

The strange thing is: If I set the range to -1000;1000 and do a solve(sqrt(x)=5;x), the result is right.

Is there any explanation I could tell my users?


The result only looks right, when showing only the default 4 decimal digits. If you increase precision, you will see the same 25,0000013034682 result.

The solver makes limited number of attempts (by an algorithm) in the specified range; it stops when subsequent attempts give close results (or when it decides that it failed). "Close" is measured relative to the range size. Some ranges may happen to give sequences that result in presize (in terms of machine representation) results; however, generally only some approximation is achieved.
С уважением, Михаил Каганский
#5 Posted: 11/22/2014 6:08:09 AM
ESKDK

ESKDK

0 likes in 7 posts.

Group: User

Hi again

It's starting to make sense

The solve function seems to give the correct answer, regardles of number of decimals, range etc.

The [calculate] - [Solve] seems to use a different algoriothm?

Right?

If I set number of decimals to 4, I se the problem with the solve under [Calculate]
If i set the number of decimals to 15, I don't se the problem.

That I don't get

All help and input much appreciated

Best regards

/Erik
SolveI.sm (33 KiB) downloaded 28 time(s).
#6 Posted: 11/22/2014 8:35:37 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

I don't recommend the use of the interactive calculation functions because:
1. You (and others) don't see what you have done in order to get the results
2. Source and result are not interlinked, thus you can't easily repeat the calculation with changed input.

I don't see any influence of the decimals setting on the results for the calculation>solve function.

If you want symbolic (exact) solutions, then you can use the function Solve() from the maxima plugin. It is basically a wrapper for the maxima function solve() and comes with the companion function Assign() for further use of the solution in the SMath sheet.

If you want to investigate/teach numerical solution procedures, then the functions from the Nonlinear Solvers plugin are appropriate. They provide an optional log of the iteration history, which can be visualized.
raphson.sm (16 KiB) downloaded 32 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 11/22/2014 10:03:21 AM
ESKDK

ESKDK

0 likes in 7 posts.

Group: User

Hi mkraska

Thanx for your time - I'll look into your example!

Have a nice weekend -

Regards

/Erik
  • New Posts New Posts
  • No New Posts No New Posts