MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: [Newbie] Ohm, Ampere, Volt units

  • To: mathgroup at
  • Subject: [mg53450] Re: [mg53426] [Newbie] Ohm, Ampere, Volt units
  • From: "David Park" <djmp at>
  • Date: Wed, 12 Jan 2005 03:41:22 -0500 (EST)
  • Sender: owner-wri-mathgroup at


I always like to consider units as well as values to be part of the data. So
I would start by defining:

data = {r -> 1 Mega Ohm, v -> 1 Milli Volt};

Then with the Unit package you could use...


i == v/r
% /. data
MapAt[Convert[#, Nano Ampere] &, %, 2] // N

i == v/r
i == (Milli*Volt)/(Mega*Ohm)
i == Ampere Nano

Notice that you have to map Convert to the right hand side of the equation
and the answer came out with the prefix after the unit because A sorts
before N.

If you want to try the V4ExtendUnits package at my web site below we can do
a little better.


i == v/r
% /. data
% // ToUnitRule[Ampere, UnitForm -> (PrefixForm[#, 2] &)]

i == v/r
i == (Milli*Volt)/(Mega*Ohm)
i == 1.0 Nano Ampere

ToUnit and ToUnitRule replace Convert. ToUnitRule automatically maps to the
rhs. The UnitForm option allows you to specify the output form of the number
(say with NumberForm or EngineeringForm) but in this case we used
PrefixForm, which automatically picks the proper prefix for the quantity and
puts the quantity in a HoldForm so that the prefix actually is a prefix.

The package also allows you to install new units, or synonyms for units. So
we could install a new unit nAmp for a nano Ampere.

InstallNewUnit[nAmp -> Nano Ampere]

i == v/r
% /. data
% // ToUnitRule[nAmp]

i == v/r
i == (Milli*Volt)/(Mega*Ohm)
i == 1. nAmp

David Park
djmp at

From: Alexander Groß [mailto:PLEASEAlexanderGrossREMOVETHIS at]
To: mathgroup at

Hi everyone,

me (a Mathematica beginner) was trying to let Mathematica do the work. I
have a very simple equation which I want Mathematica to solve and compute

Resistor = 1 Mega Ohm;
Voltage = 1 Milli Volt;
Current = Voltage / Resistor

Mathematica displays the solution of current in [Milli Volt] / [Mega Ohm].
That's not what I would like to see. I would like to resolve the units as

[Milli Volt] / [Mega Ohm] = [Milli Volt]/ [Mega [Volt / Ampere]] = [Nano

I tried the Convert[] function to achieve the desired output, but in vain.
Does anybody know how to tell Mathematica to display Ampere?

Thanks for your time and help.

Best regards,



Alexander Groß
Dipl.-Ing. (BA) für Informationstechnik
ICQ# 36765668

  • Prev by Date: Re: Newbie Programming question
  • Next by Date: Re: global assumptions?? How far can I go?
  • Previous by thread: Re: [Newbie] Ohm, Ampere, Volt units
  • Next by thread: Inverse polynomials