Re: something like dB

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

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... Needs["Miscellaneous`Units`"] dB[100 Watt, 1 Watt] 20 inversedB[20, 1 Watt] 100 Watt dB[125.5 Joule/Minute, Watt] Convert[%, 1] (10*Log[(125.5*Joule)/(Minute*Watt)])/Log[10] 3.20492 inversedB[3.204924754334133`, Watt] Convert[%, Joule/Minute] 2.09167 Watt (125.5*Joule)/Minute 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 earthlink.net http://home.earthlink.net/~djmp/ From: Zhengji Li [mailto:zhengji.li at gmail.com] To: mathgroup at smc.vnet.net 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 "function". I can define a new rule for Times: Times[0, dB] = 1, but this may slow down the kernel. Anybody know how ? Best regards.