Solve not working

Solve not working - Messages

#1 Posted: 11/2/2009 11:08:31 AM
LordMike

LordMike

0 likes in 52 posts.

Group: User

Hey,

Consider this:


Shouldn't it at least be able to solve "t+1=0, t" to "t=-1"?

It complains with: "No real roots"
#2 Posted: 11/2/2009 1:16:50 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

Please, check if Tools > Options > Calculation > Roots (range) has values range (-20, 20).
#3 Posted: 11/2/2009 1:46:32 PM
LordMike

LordMike

0 likes in 52 posts.

Group: User

Wrote

Please, check if Tools > Options > Calculation > Roots (range) has values range (-20, 20).



I tweaked it to -200 to 200... Isn't larger range better (Slower.. But more versatile).. ?

(Works now.. :/)
#4 Posted: 11/2/2009 2:16:14 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

I think there were few posts devoted to "solve" function. Please look at the picture

A numerical algorithm is behind the scene of "solve". Numerical nonlinear solver is always a "tricky" task. I think there might be some general advice concerning "solve" realized in SMath Studio.
1. Plot the function first and locate the roots.
2. It might be more advisable to use the third and fourth argument (range) were the roots are located
3. It is not advisable to use large ranges. Actually, "solve" might fail in that case.
4. If it fails, then try to locate the roots one by one with an appropriate range search.

I am not sure about all of it, but it works.

Regards,
Radovan

EDIT: For polynomials use polyroots. This will give you all the roots (real and complex) of a polynomial (zeros of polynomial equation).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 Posted: 11/2/2009 3:04:24 PM
LordMike

LordMike

0 likes in 52 posts.

Group: User

I'm not at all sure I understand why roots are relevant for solve.

I know that I will always have to keep my normal calculator by, to solve those SMath can't do.
Makes me wonder though, if my calculator can, why can't SMath.. Ofc, it's not coded so, but why not?.. :P
#6 Posted: 11/2/2009 6:12:45 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

I'm not at all sure I understand why roots are relevant for solve.


Sorry Mike, did not get your point.
Wrote

I know that I will always have to keep my normal calculator by, to solve those SMath can't do.
Makes me wonder though, if my calculator can, why can't SMath.. Ofc, it's not coded so, but why not?.. :P


It is in principal a one-man project and depends on the author's spare time to work on it (it is not a payed job ). Therefore, it is quite understandable that lots of things in SMath are missing or not working in the way we would like to. I think SMath will be much more powerful if some more people would participate in its development. As I mentioned before, "plugins" might be a driving force in that direction.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Posted: 11/2/2009 8:01:02 PM
jas0nuk

jas0nuk

0 likes in 12 posts.

Group: User

Wrote

I'm not at all sure I understand why roots are relevant for solve.

I know that I will always have to keep my normal calculator by, to solve those SMath can't do.
Makes me wonder though, if my calculator can, why can't SMath.. Ofc, it's not coded so, but why not?.. :P


Your calculator presumably uses the quadratic formula for quads and Cardano's formula for cubic equations.
SMath, on the other hand, uses bruteforce. This has the advantage that it allows roots of any equation to be found by trial and error, but it means only roots within the range can be found. So increasing the range means more roots can be found but might take a few milliseconds longer. I think changing the range to something like -1000 and 1000 would be fine.
#8 Posted: 11/2/2009 11:52:21 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3729 posts.

Group: Super Administrator

jas0nuk, you are absolutely right. Thanks.

After the last alpha version release anyone can create a better version of solve function, so, I hope someone will do it (and I'm ready to help). My goal for some time is to create a powerful platform for third-party developers and I'm working on this now.
#9 Posted: 11/3/2009 7:04:40 AM
LordMike

LordMike

0 likes in 52 posts.

Group: User

Ok.. Uhm...

If it doesn't find any roots then.. Why not have it ask if it should increase the range?
#10 Posted: 11/3/2009 7:40:27 AM
jakobg

jakobg

0 likes in 21 posts.

Group: User

Wrote

Ok.. Uhm...

If it doesn't find any roots then.. Why not have it ask if it should increase the range?


Well I'm not really sure how the solve function is implemented, but for sure it is some kind of Newton scheme to calculate the roots.
Thus bigger ranges could introduce some convergence problems (maximum allowed iteration steps, maximum error estimator).
Therefore it is not really a "good" solution to increase the range. Much better and often announced is to localize to roots and set a appropriate range.

These are ordinary numerical problems and would not show up if the solve function works symbolically (which is not always possible).

Jakob
#11 Posted: 11/3/2009 8:37:21 AM
LordMike

LordMike

0 likes in 52 posts.

Group: User

I believe it would be solved if it was intrododuced as such:

1. Try current roots range
2a. If failed
2a3. Ask user for permission, try again with larger range

2b. If success
2b3. Success

Then keep going, till result is found or user quits.
  • New Posts New Posts
  • No New Posts No New Posts