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 LordMike  
#1 Posted : 02 November 2009 17:08:31(UTC)
LordMike


Rank: Advanced Member

Groups: Registered
Joined: 24/10/2009(UTC)
Posts: 52
Man
Location: Denmark

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"

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

Offline Andrey Ivashov  
#2 Posted : 02 November 2009 19:16:50(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Please, check if Tools > Options > Calculation > Roots (range) has values range (-20, 20).
Offline LordMike  
#3 Posted : 02 November 2009 19:46:32(UTC)
LordMike


Rank: Advanced Member

Groups: Registered
Joined: 24/10/2009(UTC)
Posts: 52
Man
Location: Denmark

smath 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.. :/)
Offline omorr  
#4 Posted : 02 November 2009 20:16:14(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)
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).

Edited by user 03 November 2009 02:23:33(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline LordMike  
#5 Posted : 02 November 2009 21:04:24(UTC)
LordMike


Rank: Advanced Member

Groups: Registered
Joined: 24/10/2009(UTC)
Posts: 52
Man
Location: Denmark

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
Offline omorr  
#6 Posted : 03 November 2009 00:12:45(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)
LordMike wrote:
I'm not at all sure I understand why roots are relevant for solve.

Sorry Mike, did not get your point.
LordMike 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!"
Offline jas0nuk  
#7 Posted : 03 November 2009 02:01:02(UTC)
jas0nuk


Rank: Member

Groups: Registered
Joined: 15/03/2009(UTC)
Posts: 12
Location: UK

LordMike 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.
Offline Andrey Ivashov  
#8 Posted : 03 November 2009 05:52:21(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
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.
Offline LordMike  
#9 Posted : 03 November 2009 13:04:40(UTC)
LordMike


Rank: Advanced Member

Groups: Registered
Joined: 24/10/2009(UTC)
Posts: 52
Man
Location: Denmark

Ok.. Uhm...

If it doesn't find any roots then.. Why not have it ask if it should increase the range?
Offline jakobg  
#10 Posted : 03 November 2009 13:40:27(UTC)
jakobg


Rank: Member

Groups: Registered
Joined: 20/03/2009(UTC)
Posts: 21
Man
Location: Vienna, AUSTRIA

LordMike 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
Offline LordMike  
#11 Posted : 03 November 2009 14:37:21(UTC)
LordMike


Rank: Advanced Member

Groups: Registered
Joined: 24/10/2009(UTC)
Posts: 52
Man
Location: Denmark

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.
Users browsing this topic
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.