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 zureks  
#1 Posted : 04 March 2011 14:39:06(UTC)
zureks

Rank: Newbie

Groups: Registered
Joined: 21/01/2011(UTC)
Posts: 9
Location: UK

I have the following peculiar problem which seems to be linked to the "while loop". I calculate a value and iterate it a few times in a while loop (please see the link below). The result of the calculation changes very little between 3 or 4 iterations. However, when I try to use this result in an equation later I get an error message "Result is above max. allowed positive number."

This happens when the while loop is executed 4 times and more (bottom part of the screenshot), but does not when the loop is executed 3 times or less (top part). The numerical value changes less than 5%, so it cannot be that?

https://docs.google.com/..._GB&authkey=CObT0e8O

I would appreciate any comments.

Regards

Stan

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

Offline omorr  
#2 Posted : 04 March 2011 15:57: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)
Hello Stan,

In those or similar problems with the same error message, you can try disabling Symbolic optimization (Right click and choose Optimization|None or Numeric). On the other hand, when you have an iterative procedure as in your case, "gap=f(gap)", the symbolic answer might be quite complicated including the mentioned error message "Result is above max. allowed positive number.". Moreover, you are interested only in the numerical value and therefore you might consider using eval() function in those cases i.e. "gap=eval(f(gap)".

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline zureks  
#3 Posted : 05 March 2011 22:17:33(UTC)
zureks

Rank: Newbie

Groups: Registered
Joined: 21/01/2011(UTC)
Posts: 9
Location: UK

Thank you Radovan.

I know I can find a workaround, but it was just interesting to see that even though there is no problem with calculating the number (the while loop always executes fine) the value does not work when used later.

Regards

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