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 jenspraest  
#1 Posted : 19 November 2012 12:45:57(UTC)
jenspraest

Rank: Newbie

Groups: Registered
Joined: 07/11/2011(UTC)
Posts: 3
Location: Denmark

I was making a calculation of E.pot = m*h*g, m= 65kg h=3,5m g=9,82m/s^2
if I write 'h*m*g=' I get 2234,05J, but if I write
'E.pot:=m*g*h E.pot=' I get 2405,9J


edit: smath file attached

Edited by user 19 November 2012 14:46:40(UTC)  | Reason: smath file attached

File Attachment(s):
Side4.sm (9kb) downloaded 22 time(s).

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

Offline omorr  
#2 Posted : 19 November 2012 13:38:35(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,

I think you've made some mistake here.
Please attach the problematic SMath file to the post.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Davide Carpi  
#3 Posted : 20 November 2012 18:14:50(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,648
Man
Italy
Location: Italy

Was thanked: 1331 time(s) in 876 post(s)
Originally Posted by: jenspraest Go to Quoted Post
I was making a calculation of E.pot = m*h*g, m= 65kg h=3,5m g=9,82m/s^2
if I write 'h*m*g=' I get 2234,05J, but if I write
'E.pot:=m*g*h E.pot=' I get 2405,9J

edit: smath file attached


Hi jenspraest,

It's not a bug, just a behavior...


Please hold the mouse on the E.pot definition... you can see that SMath assign all available variables, so when you make a call to E.pot only the h value will be replaced; to have the "right" behavior you need to place the definition before the variable assignments or to create a function E.pot(m,h)

regards,

w3b5urf3r
File Attachment(s):
Side4-1.sm (11kb) downloaded 13 time(s).
Davide Carpi attached the following image(s):
SMath Studio - [Side4.sm].png
PrtScr capture.png
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline jabadu  
#4 Posted : 24 November 2012 16:10:06(UTC)
jabadu


Rank: Advanced Member

Groups: Registered
Joined: 10/11/2010(UTC)
Posts: 37
Location: Germany

Was thanked: 1 time(s) in 1 post(s)
This is already a known behavior - see this post:

overridung variables depends on position of variable assignment

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.