~~~
Gunter,
Maxima has more than one units package. Each addresses a different aspect of units usage.
In particular for the bsiunits.mac program, where the b in the name stands for basic, there is no setunits() command,
rather units are set to the metric base units only. The units of a physical quantity and the metric prefixes
are adjoined to a pure number with multiplication, so for example:
(%i1)("~my path/bsiunits.mac")$
[meter,kilogram,second,ampere,kelvin,mol,candela]
"Type units_help() to display units help"
(%i2) 24*kilo*meter;
(%o2) 24000*meter
ohm is a derived unit, then correctly:
(%i3) ohm;
(%o3) (kg*meter^2)/(amp^2*sec^3)
your example results in 2 ohm as desired with no absolute signs:
(%i4) sqrt((2*ohm)^2);
(%o4) (2*kg*meter^2)/(amp^2*sec^3)
we can actually express the result in units of ohm explicitly using the ' do not evaluate operator:
(%i5) sqrt((2*ohm)^2)*'ohm/ohm
(%o5) 2*ohm
(%i6) 0.47*pico*farad*'(picofarad)/(pico*farad);
(%o6) 0.47*picofarad
but the above may be regarded as somewhat cumbersome
bsiunits is intended for conversion in to base units, like this:
(%i7) 0.47*pico*farad;
(%o7) (4.6999999999999992*10^-13*amp^2*sec^4)/(kg*meter^2)
(%i8) (nano*second)/(kilo*ohm*pico*farad) /* time/(time constant) */;
(%o8) 1
If we wish to display derived units, like ohm, in the results ; or display named units, like picofarad, in the results,
- then bsiunts is probably not a good first choice
hope this helps,
ear.
~~~
-----Original Message-----
>From: Gunter K?nigsmann <gunter at peterpall.de>
>Sent: Feb 2, 2013 1:21 PM
>To: maxima at math.utexas.edu
>Subject: Re: [Maxima] Question about cancelling out units
>
>Dear Edward,
>
>Thanks a lot! This has solved most of my problems - there was a second
>one (maxima did insist in using other units than I am used to, which was
>solved by setunits([kilometer,second]).
>For the last problem I had to solve I have a question, though:
>Do you - or does anybody else in this list - know if there is a good
>reason why unit.mac cannot automatically do a
>
>assume(kilometer>0,farad>0,ohm>0);
>
>and so on? Without this assumption
>
>sqrt((2*ohm)^2)
>results in:
> 2|ohm|
>instead of:
> 2 ohm
>since maxima has no way of determining if 2*ohm is positive or negative.
>Not defining units to be positive or negative sounds right at the first
>sight. But it prevents from optimizing things like (a*|ohm|*a*ohm)/(a*|
>ohm|+a*ohm) and tends to provoke errors when a is assigned a value.
>
>---
>
>Just for interest: Both the source of unit.mac and the manual seem to
>indicate that
>
>metricexpandall(3);
>
>should enable me to use units like picrofarad or femtogram but in
>reality doesn't seem to define these units.
>Does anybody know if I got something wrong or if I found a bug?
>
>Thanks again,
>and
>Kind regards,
>
> Gunter.
>
>
>Am Mittwoch, den 23.01.2013, 11:11 -0800 schrieb Edward A Romana:
>> ~~
>>
>> Gunter
>>
>> First load the units program
>>
>> (%i1) load("C:/~path/bsiunits.mac")$
>> [meter,kilogram,second,ampere,kelvin,mol,candela]
>> "Type units_help() to display units help"
>>
>> For your expression %e^(numerical_value * unit_dimensionless_group )
>> then
>>
>> (%i2) %e^(1*second/(1*farad*1*ohm));
>> (%o2) %e
>>
>> Also, the style for units has: the unit name is always singular. The
>> nice single letter unit symbols are not used in units,
>> does 'm' stand for mass or meters etc. Unit names are somewhat
>> verbose.
>>
>>
>>
>>
>> ear.