Integral with measurement units

Integral with measurement units - Сообщения

#1 Опубликовано: 08.01.2013 05:17:32
gfggirardi

gfggirardi

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

Группа: User

Hello everybody.
I'm using a definite integral of a function with a variable defined with measurement unit.
When I try to obtain the value of the integral I get an error saying that the variable is not defined.
I tried removing the measurement unit dividing the variable by the measurement unit itself but I get the same error.

Thank you very much for any suggestion.
#2 Опубликовано: 08.01.2013 09:07:20
Radovan Omorjan

Radovan Omorjan

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

Группа: Moderator

Hello,

I would generally discourage using units in solving definite integrals by SMath. This method was not meant to be used with units, AFAIK. On the other hand, this might be a source of mistakes and confusions.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 08.01.2013 12:13:48
callmeishmael

callmeishmael

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

Группа: User

omorr,
this time I disagree with you. A definite integral of a physical quantity is perfectly defined and has strong meaning.
No mistakes should be expected in the undestanding of such integrals.
I can understand that for technical reasons this may be not (yet) implemented on SMath, but in that case it would be much better to prevent the user, raising an error if a definite integral is used with units. Actual behavior is wrong.
For example I defined
V0=20 m/s
t1=0 s
t2=10 s

The definite integral of V0*dt with t from t1 to t2 is the space traveled at the constant V0 speed in t2-t1=10s. I should get meters, instead the result of the integral is still a speed.
May be I'm a bit oversimplifying, but the resulting unit shall simply be the unit of the function multiplied the unit of the boundaries (which shall be the same). It should be not too hard to be implemented.

Thanks :-)

Andrea
#4 Опубликовано: 08.01.2013 12:59:36
gfggirardi

gfggirardi

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

Группа: User

Thank you very much for your answer,
I've attached a file that's explaining the error that I get.
resource1.sm (13 КиБ) скачан 77 раз(а).
#5 Опубликовано: 08.01.2013 13:14:02
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Thank you very much for your answer,
I've attached a file that's explaining the error that I get.



This should be correct (I hope...)
SMath Studio - [resource1.sm].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#6 Опубликовано: 08.01.2013 14:42:35
kilele

kilele

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

Группа: User

Good point:
If your function involves units you must specify units on the independent variables when calling the function.

Edit:
Anyway on my sample the integral seems problematic dealing with units, since it should return square meters.

Edit2:
Sorry for the confussion, the integral works fine here!
I wanted to assign units to the result taking into account the geometrical interpretation of line integral, similarly Callmeishmael referred to units for the physical meaning of velocity.
integralunits.png
1 пользователям понравился этот пост
Davide Carpi 09.01.2013 08:44:00
#7 Опубликовано: 09.01.2013 05:03:04
gfggirardi

gfggirardi

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

Группа: User

Thank you very much for your suggestions: now the formula is working correctly.
#8 Опубликовано: 12.11.2014 15:02:20
zapzapouch

zapzapouch

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

Группа: User

Wrote

Good point:
If your function involves units you must specify units on the independent variables when calling the function.



I don't understand. If you have a constant power dissipation of 1 W for 1 second, you will consume 1 J of energy. To write this in integral form: [see attached image]

int(1 W, dt, 1 sec, 2 sec) should equal 1 W * (2 sec - 1 sec) = 1 J

So why can't we use units in the limits of the integral?
smath integral.png
#9 Опубликовано: 12.11.2014 16:14:37
sergio

sergio

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

Группа: User

Problems with the integrals are known. You can find more details in the Interactive SMath Handbook (author Martin Kraska).
At the moment, your problem can be solved as in attached figure
[albumimg]364[/albumimg]

sergio
#10 Опубликовано: 12.11.2014 17:13:44
zapzapouch

zapzapouch

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

Группа: User

So you're basically removing the units before the integral and then re-adding them after it's done? What does LE stand for and why is it blue like a unit for you? It's not for me.
#11 Опубликовано: 13.11.2014 03:32:05
brotjob

brotjob

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

Группа: User

The approach posted by PompelmoTell is now obsolete. Do like in the example attached.

To create your own units you start with an apostroph: 'LE gives you the blue colour.
int_with_units.png
#12 Опубликовано: 13.11.2014 12:33:13
zapzapouch

zapzapouch

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

Группа: User

..assuming you have the Maxima plugin installed and Maxima installed?
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений