Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Units conversion

7 views
Skip to first unread message

Thomas Dean

unread,
Jan 18, 2012, 1:12:11 AM1/18/12
to
I am attempting to convert tesla*meter/second to volts/meter.

I can almost get there.

restart; with(ScientificConstants);
E := 30*10^(-15)*Unit('T')*GetValue(Constant(c))*Unit('m')/Unit('s');
teslaDefn := Unit('V')*Unit('s')/(Unit('m')*Unit('m'));
velocityDefn := Unit('m')/Unit('s');
teslaDefn*velocityDefn;
voltDefn:=
(Unit('kg')*Unit('m')*Unit('m'))/((Unit('s')*Unit('s'))*Unit('s')*Unit('A'));
voltDefn/Unit('m');

How to I get E's units to be volts/meter?

Tom Dean

acer

unread,
Jan 18, 2012, 9:03:06 AM1/18/12
to
You can define and use a modified version of the SI system in which volts/meter is the default for expressing items with the same dimensions as of kg*m/s^3*A.

(This is typeset in ascii, but of course the units get printed more nicely with the double [[]] brackets in the GUI.)

restart;

with(ScientificConstants):

E := 30*10^(-15)*Unit('T')*GetValue(Constant(c))*Unit('m')/Unit('s');

449688687 Units:-Unit('T') Units:-Unit('m')
-------------------------------------------
50000000000000 Units:-Unit('s')

combine(E,units);

449688687 /('kg') ('m')\
-------------- Units:-Unit|------------|
50000000000000 | 3 |
\('s') ('A')/

convert(combine(E,units),units,volts/meter);

449688687 /'V'\
-------------- Units:-Unit|---|
50000000000000 \'m'/

simplify(%); # back to where we started, as it is not special to SI

449688687 /('kg') ('m')\
-------------- Units:-Unit|------------|
50000000000000 | 3 |
\('s') ('A')/

# define a new version of SI
Units:-AddSystem(newSI,Units:-GetSystem(SI),volts/meter);
Units:-UseSystem(newSI);

combine(E,units); # now done in one step (and `simplify` does not undo it)

449688687 /'V'\
-------------- Units:-Unit|---|
50000000000000 \'m'/


That should also play reasonably nicely with more automatic simplification of units with arithmetic that one gets after loading Unit:-Standard.

best,
acer
0 new messages