same equation, different result

same equation, different result - Сообщения

#1 Опубликовано: 19.11.2012 05:45:57
Jens Præst

Jens Præst

0 сообщений из 3 понравились пользователям.

Группа: User

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
Side4.sm (8 КиБ) скачан 68 раз(а).
#2 Опубликовано: 19.11.2012 06:38:35
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

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!"
#3 Опубликовано: 20.11.2012 11:14:50
Davide Carpi

Davide Carpi

1417 сообщений из 2873 понравились пользователям.

Группа: Moderator

Wrote

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 [MATH lang=eng]E.pot[/MATH] definition... you can see that SMath assign all available variables, so when you make a call to [MATH lang=eng]E.pot[/MATH] only the [MATH]h[/MATH] value will be replaced; to have the "right" behavior you need to place the definition before the variable assignments or to create a function [MATH lang=eng]E.pot(m,h)[/MATH]

regards,

w3b5urf3r
PrtScr capture.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Опубликовано: 24.11.2012 09:10:06
jabadu

jabadu

1 сообщений из 37 понравились пользователям.

Группа: User

This is already a known behavior - see this post:

overridung variables depends on position of variable assignment

  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений