MathGroup Archive 2005

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

Search the Archive

Re: something like dB

  • To: mathgroup at
  • Subject: [mg56563] Re: [mg56516] something like dB
  • From: "David Park" <djmp at>
  • Date: Fri, 29 Apr 2005 03:20:09 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I don't think that dB is properly a 'Unit'. It is a function that returns a
pure number. We could define the function and it's inverse as follows.

dB[p_, p0_] := 10 Log[10, p/p0]
inversedB[dB_, p0_] := p0 10^(dB/10)

Then, installing the Units package, we have...


dB[100 Watt, 1 Watt]

inversedB[20, 1 Watt]
100 Watt

dB[125.5 Joule/Minute, Watt]
Convert[%, 1]

inversedB[3.204924754334133`, Watt]
Convert[%, Joule/Minute]
2.09167 Watt

It is only sloppyness to say that something is x dB. (Maybe I'll hear
differently from other responders.) In any case, if you use 0.0 dB then the
0.0 will be retained, but if you write exact 0 anything Mathematica always
returns 0.

David Park
djmp at

From: Zhengji Li [ at]
To: mathgroup at

Dear Mathematica ers,

    In engineering, we always like values such as power be represented
in dB form.
I can make dB as a Unit, but things go to strange when 0 dB occurs:

    Times[0, dB] will give 0 no matter dB is ReadProtected or not.

    I have tried to define a upvalue for dB:

              dB /: Times[0, dB] = 1; but Mathematica do not allow
this cause dB is not a

     I can define a new rule for Times: Times[0, dB] = 1, but this may
slow down the
kernel. Anybody know how ?

     Best regards.

  • Prev by Date: Re: Using BarChart in a Widget
  • Next by Date: Re: Re: Re: odd mathematica blindspot
  • Previous by thread: Re: something like dB
  • Next by thread: Re: something like dB