MathGroup Archive 2005

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

Search the Archive

Re: How to create units?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60263] Re: [mg60241] How to create units?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Fri, 9 Sep 2005 04:07:02 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Renan,

With the V4ExtendUnits package from my web site below you can install your
own units. (I'm not certain if I have the correct definition of all your
information units.)

Needs["Miscellaneous`V4ExtendUnits`"]

InstallNewUnit /@ {kibibyte -> 1024*Byte,
    mibibyte -> 1024^2*Byte, gibibyte -> 1024^3*Byte};

NewUnitRules
{kibibyte -> 8192.*Bit, mibibyte -> 8.388608*^6*Bit,
  gibibyte -> 8.589934592*^9*Bit}

kibibyte // ToUnit[Byte]
1024. Byte

1024 Byte // ToUnit[kibibyte]
1. kibibyte

32.5 gibibyte // ToUnit[{Byte, Bit}]
{3.489660928*^10*Byte, 2.7917287424*^11*Bit}

But I didn't check for Bit as a base unit in the old package and updated it
for this today. So you must use a 9 Sep 2005 or later version.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/





From: Renan [mailto:renan.birck at gmail.com]
To: mathgroup at smc.vnet.net


Hello,

I'd like to define custom units in Mathematica. Is this possible?
I want to define "binary units" (kibi/mibi/gibibytes) as used in
computers, because currently:

In[1]:= Convert[1 Kilo Byte,Byte]

Out[1]= 1000 Byte

When it is supposed to be 1024 bytes.


How to define custom unit?

Thanks!





  • Prev by Date: Precedence
  • Next by Date: Switching to Mac caused 20x slowdown - please help!
  • Previous by thread: How to create units?
  • Next by thread: Re: How to create units?