aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc/calc.texi
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /doc/misc/calc.texi
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'doc/misc/calc.texi')
-rw-r--r--doc/misc/calc.texi235
1 files changed, 116 insertions, 119 deletions
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 88103fc0034..f732eff5690 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -28126,47 +28126,15 @@ tell Calc to use a different file for the Calc init file.)
28126@section Logarithmic Units 28126@section Logarithmic Units
28127 28127
28128The units @code{dB} (decibels) and @code{Np} (nepers) are logarithmic 28128The units @code{dB} (decibels) and @code{Np} (nepers) are logarithmic
28129units which are typically manipulated differently than standard units. 28129units which are manipulated differently than standard units. Calc
28130Calc provides commands to work with these logarithmic units. 28130provides commands to work with these logarithmic units.
28131 28131
28132Decibels and nepers are used to measure power quantities as well as 28132Decibels and nepers are used to measure power quantities as well as
28133field quantities (quantities whose squares are proportional to power). 28133field quantities (quantities whose squares are proportional to power);
28134The decibel and neper values of a quantity are relative to 28134these two types of quantities are handled slightly different from each
28135a reference quantity; for example, the decibel value of a sound 28135other. By default the Calc commands work as if power quantities are
28136pressure level of 28136being used; with the @kbd{H} prefix the Calc commands work as if field
28137@infoline @math{60 uPa} 28137quantities are being used.
28138@texline @math{60 \mu{\rm Pa}}
28139relative to
28140@infoline @math{20 uPa}
28141@texline @math{20 \mu{\rm Pa}}
28142(the threshhold of human hearing) is
28143@infoline @math{20 log10(60 uPa/ 20 uPa) dB = 20 log10(3) dB},
28144@texline @math{20 \log_{10}(60 \mu{\rm Pa}/20 \mu{\rm Pa}) {\rm dB} = 20 \log_{10}(3) {\rm dB}},
28145which is about
28146@infoline @math{9.54 dB}.
28147@texline @math{9.54 {\rm dB}}.
28148Note that in taking the ratio, the original units cancel and so these
28149logarithmic units are dimensionless.
28150
28151@vindex calc-logunits-power-reference
28152@vindex calc-logunits-field-reference
28153The Calc commands for the logarithmic units assume that power quantities
28154are being used unless the @kbd{H} prefix is used, in which case they assume that
28155field quantities are being used. For power quantities, Calc uses
28156@infoline @math{1 mW}
28157@texline @math{1 {\rm mW}}
28158as the default reference quantity; this default can be changed by changing
28159the value of the customizable variable
28160@code{calc-logunits-power-reference} (@pxref{Customizing Calc}).
28161For field quantities, Calc uses
28162@infoline @math{20 uPa}
28163@texline @math{20 \mu{\rm Pa}}
28164as the default reference quantity; this is the value used in acoustics
28165which is where decibels are commonly encountered. This default can be
28166changed by changing the value of the customizable variable
28167@code{calc-logunits-field-reference} (@pxref{Customizing Calc}). A
28168non-default reference quantity will be read from the stack if the
28169capital @kbd{O} prefix is used.
28170 28138
28171The decibel level of a power 28139The decibel level of a power
28172@infoline @math{P1}, 28140@infoline @math{P1},
@@ -28214,6 +28182,20 @@ relative to a reference
28214is defined as 28182is defined as
28215@infoline @math{20 log10(F1/F0) dB}. 28183@infoline @math{20 log10(F1/F0) dB}.
28216@texline @math{20 \log_{10}(F_{1}/F_{0}) {\rm dB}}. 28184@texline @math{20 \log_{10}(F_{1}/F_{0}) {\rm dB}}.
28185For example, the decibel value of a sound pressure level of
28186@infoline @math{60 uPa}
28187@texline @math{60 \mu{\rm Pa}}
28188relative to
28189@infoline @math{20 uPa}
28190@texline @math{20 \mu{\rm Pa}}
28191(the threshhold of human hearing) is
28192@infoline @math{20 log10(60 uPa/ 20 uPa) dB = 20 log10(3) dB},
28193@texline @math{20 \log_{10}(60 \mu{\rm Pa}/20 \mu{\rm Pa}) {\rm dB} = 20 \log_{10}(3) {\rm dB}},
28194which is about
28195@infoline @math{9.54 dB}.
28196@texline @math{9.54 {\rm dB}}.
28197Note that in taking the ratio, the original units cancel and so these
28198logarithmic units are dimensionless.
28217 28199
28218Nepers (named after John Napier, who is credited with inventing the 28200Nepers (named after John Napier, who is credited with inventing the
28219logarithm) are similar to bels except they use natural logarithms instead 28201logarithm) are similar to bels except they use natural logarithms instead
@@ -28236,55 +28218,72 @@ is
28236@infoline @math{ln(F1/F0) Np}. 28218@infoline @math{ln(F1/F0) Np}.
28237@texline @math{\ln(F_1/F_0) {\rm Np}}. 28219@texline @math{\ln(F_1/F_0) {\rm Np}}.
28238 28220
28221@vindex calc-lu-power-reference
28222@vindex calc-lu-field-reference
28223For power quantities, Calc uses
28224@infoline @math{1 mW}
28225@texline @math{1 {\rm mW}}
28226as the default reference quantity; this default can be changed by changing
28227the value of the customizable variable
28228@code{calc-lu-power-reference} (@pxref{Customizing Calc}).
28229For field quantities, Calc uses
28230@infoline @math{20 uPa}
28231@texline @math{20 \mu{\rm Pa}}
28232as the default reference quantity; this is the value used in acoustics
28233which is where decibels are commonly encountered. This default can be
28234changed by changing the value of the customizable variable
28235@code{calc-lu-field-reference} (@pxref{Customizing Calc}). A
28236non-default reference quantity will be read from the stack if the
28237capital @kbd{O} prefix is used.
28238
28239@kindex l q 28239@kindex l q
28240@pindex calc-logunits-quantity 28240@pindex calc-lu-quant
28241@tindex powerquant 28241@tindex lupquant
28242@tindex fieldquant 28242@tindex lufquant
28243The @kbd{l q} (@code{calc-logunits-quantity}) [@code{powerquant}] 28243The @kbd{l q} (@code{calc-lu-quant}) [@code{lupquant}]
28244command computes the power quantity corresponding to a given number of 28244command computes the power quantity corresponding to a given number of
28245logarithmic units. With the capital @kbd{O} prefix, @kbd{O l q}, the 28245logarithmic units. With the capital @kbd{O} prefix, @kbd{O l q}, the
28246reference level will be read from the top of the stack. (In an 28246reference level will be read from the top of the stack. (In an
28247algebraic formula, @code{powerquant} can be given an optional second 28247algebraic formula, @code{lupquant} can be given an optional second
28248argument which will be used for the reference level.) For example, 28248argument which will be used for the reference level.) For example,
28249@code{20 dB @key{RET} l q} will return @code{100 mW}; 28249@code{20 dB @key{RET} l q} will return @code{100 mW};
28250@code{20 dB @key{RET} 4 W @key{RET} O l q} will return @code{400 W}. 28250@code{20 dB @key{RET} 4 W @key{RET} O l q} will return @code{400 W}.
28251The @kbd{H l q} [@code{fieldquant}] command behaves like @kbd{l q} but 28251The @kbd{H l q} [@code{lufquant}] command behaves like @kbd{l q} but
28252computes field quantities instead of power quantities. 28252computes field quantities instead of power quantities.
28253 28253
28254@kindex l d 28254@kindex l d
28255@pindex calc-dblevel 28255@pindex calc-db
28256@tindex dbpowerlevel 28256@tindex dbpower
28257@tindex dbfieldlevel 28257@tindex dbfield
28258@kindex l n 28258@kindex l n
28259@pindex calc-nplevel 28259@pindex calc-np
28260@tindex nppowerlevel 28260@tindex nppower
28261@tindex npfieldlevel 28261@tindex npfield
28262The @kbd{l d} (@code{calc-dblevel}) [@code{dbpowerlevel}] 28262The @kbd{l d} (@code{calc-db}) [@code{dbpower}] command will compute
28263command will compute the decibel level of a power quantity using the 28263the decibel level of a power quantity using the default reference
28264default reference level; @kbd{H l d} [@code{dbfieldlevel}] will 28264level; @kbd{H l d} [@code{dbfield}] will compute the decibel level of
28265compute the decibel level of a field quantity. The commands @kbd{l n} 28265a field quantity. The commands @kbd{l n} (@code{calc-np})
28266(@code{calc-nplevel}) [@code{nppowerlevel}] and @kbd{H l n} 28266[@code{nppower}] and @kbd{H l n} [@code{npfield}] will similarly
28267[@code{npfieldlevel}] will similarly compute neper levels. With the 28267compute neper levels. With the capital @kbd{O} prefix these commands
28268capital @kbd{O} prefix these commands will read a reference level 28268will read a reference level from the stack; in an algebraic formula
28269from the stack; in an algebraic formula the reference level can be 28269the reference level can be given as an optional second argument.
28270given as an optional second argument.
28271 28270
28272@kindex l + 28271@kindex l +
28273@pindex calc-logunits-add 28272@pindex calc-lu-plus
28274@tindex lupoweradd 28273@tindex lupadd
28275@tindex lufieldadd 28274@tindex lufadd
28276@kindex l - 28275@kindex l -
28277@pindex calc-logunits-sub 28276@pindex calc-lu-minus
28278@tindex lupowersub 28277@tindex lupsub
28279@tindex lufieldsub 28278@tindex lufsub
28280@kindex l * 28279@kindex l *
28281@pindex calc-logunits-mul 28280@pindex calc-lu-times
28282@tindex lupowermul 28281@tindex lupmul
28283@tindex lufieldmul 28282@tindex lufmul
28284@kindex l / 28283@kindex l /
28285@pindex calc-logunits-div 28284@pindex calc-lu-divide
28286@tindex lupowerdiv 28285@tindex lupdiv
28287@tindex lufielddiv 28286@tindex lufdiv
28288The sum of two power or field quantities doesn't correspond to the sum 28287The sum of two power or field quantities doesn't correspond to the sum
28289of the corresponding decibel or neper levels. If the powers 28288of the corresponding decibel or neper levels. If the powers
28290corresponding to decibel levels 28289corresponding to decibel levels
@@ -28305,13 +28304,13 @@ $$ 10 \log_{10}(10^{D_1/10} + 10^{D_2/10}) {\rm dB}.$$
28305@end tex 28304@end tex
28306 28305
28307@noindent 28306@noindent
28308When field quantities are combined, it often means the 28307When field quantities are combined, it often means the corresponding
28309corresponding powers are added and so the above formula might be used. 28308powers are added and so the above formula might be used. In
28310In acoustics, for example, the decibel sound pressure level is defined 28309acoustics, for example, the sound pressure level is a field quantity
28311using the field formula but the sound pressure levels are combined 28310and so the decibels are often defined using the field formula, but the
28312as the sound power levels, and so the above formula should be used. If 28311sound pressure levels are combined as the sound power levels, and so
28313two field quantities themselves are added, the new decibel level will be 28312the above formula should be used. If two field quantities themselves
28314 28313are added, the new decibel level will be
28315 28314
28316@ifnottex 28315@ifnottex
28317@example 28316@example
@@ -28349,20 +28348,18 @@ $$ D + 20 \log_{10}(N) {\rm dB}.$$
28349@end tex 28348@end tex
28350 28349
28351@noindent 28350@noindent
28352There are similar formulas for combining nepers. 28351There are similar formulas for combining nepers. The @kbd{l +}
28353The @kbd{l +} (@code{calc-logunits-add}) [@code{lupoweradd}] command 28352(@code{calc-lu-plus}) [@code{lupadd}] command will ``add'' two
28354will ``add'' two logarithmic unit power levels this way; with the 28353logarithmic unit power levels this way; with the @kbd{H} prefix,
28355@kbd{H} prefix, @kbd{H l +} [@code{lufieldadd}] will add logarithmic 28354@kbd{H l +} [@code{lufadd}] will add logarithmic unit field levels.
28356unit field levels. Similarly, logarithmic units can be 28355Similarly, logarithmic units can be ``subtracted'' with @kbd{l -}
28357``subtracted'' with @kbd{l -} (@code{calc-logunits-sub}) 28356(@code{calc-lu-minus}) [@code{lupsub}] or @kbd{H l -} [@code{lufsub}].
28358[@code{lupowersub}] or @kbd{H l -} [@code{lufieldsub}]. 28357The @kbd{l *} (@code{calc-lu-times}) [@code{lupmul}] and @kbd{H l *}
28359The @kbd{l *} (@code{calc-logunits-mul}) [@code{lupowermul}] 28358[@code{lufmul}] commands will ``multiply'' a logarithmic unit by a
28360and @kbd{H l *} [@code{lufieldmul}] commands will ``multiply'' 28359number; the @kbd{l /} (@code{calc-lu-divide}) [@code{lupdiv}] and
28361a logarithmic unit by a number; the @kbd{l /} 28360@kbd{H l /} [@code{lufdiv}] commands will ``divide'' a logarithmic
28362(@code{calc-logunits-divide}) [@code{lupowerdiv}] and 28361unit by a number. Note that the reference quantities don't play a role
28363@kbd{H l /} [@code{lufielddiv}] commands will ``divide'' a 28362in this arithmetic.
28364logarithmic unit by a number. Note that the reference quantities don't
28365play a role in this arithmetic.
28366 28363
28367@node Musical Notes, , Logarithmic Units, Units 28364@node Musical Notes, , Logarithmic Units, Units
28368@section Musical Notes 28365@section Musical Notes
@@ -35539,16 +35536,16 @@ should also be added to @code{calc-embedded-announce-formula-alist}
35539and @code{calc-embedded-open-close-plain-alist}. 35536and @code{calc-embedded-open-close-plain-alist}.
35540@end defvar 35537@end defvar
35541 35538
35542@defvar calc-logunits-power-reference 35539@defvar calc-lu-power-reference
35543@defvarx calc-logunits-field-reference 35540@defvarx calc-lu-field-reference
35544See @ref{Logarithmic Units}.@* 35541See @ref{Logarithmic Units}.@*
35545The variables @code{calc-logunits-power-reference} and 35542The variables @code{calc-lu-power-reference} and
35546@code{calc-logunits-field-reference} are unit expressions (written as 35543@code{calc-lu-field-reference} are unit expressions (written as
35547strings) which Calc will use as reference quantities for logarithmic 35544strings) which Calc will use as reference quantities for logarithmic
35548units. 35545units.
35549 35546
35550The default value of @code{calc-logunits-power-reference} is @code{"mW"} 35547The default value of @code{calc-lu-power-reference} is @code{"mW"}
35551and the default value of @code{calc-logunits-field-reference} is 35548and the default value of @code{calc-lu-field-reference} is
35552@code{"20 uPa"}. 35549@code{"20 uPa"}.
35553@end defvar 35550@end defvar
35554 35551
@@ -36209,26 +36206,26 @@ keystrokes are not listed in this summary.
36209@r{ v x@: I k T @: @: @:ltpt@:(x,v)} 36206@r{ v x@: I k T @: @: @:ltpt@:(x,v)}
36210 36207
36211@c 36208@c
36212@r{ a b@: l + @: @: @:lupoweradd@:(a,b)} 36209@r{ a b@: l + @: @: @:lupadd@:(a,b)}
36213@r{ a b@: H l + @: @: @:lufieldadd@:(a,b)} 36210@r{ a b@: H l + @: @: @:lufadd@:(a,b)}
36214@r{ a b@: l - @: @: @:lupowersub@:(a,b)} 36211@r{ a b@: l - @: @: @:lupsub@:(a,b)}
36215@r{ a b@: H l - @: @: @:lufieldsub@:(a,b)} 36212@r{ a b@: H l - @: @: @:lufsub@:(a,b)}
36216@r{ a b@: l * @: @: @:lupowermul@:(a,b)} 36213@r{ a b@: l * @: @: @:lupmul@:(a,b)}
36217@r{ a b@: H l * @: @: @:lufieldmul@:(a,b)} 36214@r{ a b@: H l * @: @: @:lufmul@:(a,b)}
36218@r{ a b@: l / @: @: @:lupowerdiv@:(a,b)} 36215@r{ a b@: l / @: @: @:lupdiv@:(a,b)}
36219@r{ a b@: H l / @: @: @:lufielddiv@:(a,b)} 36216@r{ a b@: H l / @: @: @:lufdiv@:(a,b)}
36220@r{ a@: l d @: @: @:dbpowerlevel@:(a)} 36217@r{ a@: l d @: @: @:dbpower@:(a)}
36221@r{ a b@: O l d @: @: @:dbpowerlevel@:(a,b)} 36218@r{ a b@: O l d @: @: @:dbpower@:(a,b)}
36222@r{ a@: H l d @: @: @:dbfieldlevel@:(a)} 36219@r{ a@: H l d @: @: @:dbfield@:(a)}
36223@r{ a b@: O H l d @: @: @:dbfieldlevel@:(a,b)} 36220@r{ a b@: O H l d @: @: @:dbfield@:(a,b)}
36224@r{ a@: l n @: @: @:nppowerlevel@:(a)} 36221@r{ a@: l n @: @: @:nppower@:(a)}
36225@r{ a b@: O l n @: @: @:nppowerlevel@:(a,b)} 36222@r{ a b@: O l n @: @: @:nppower@:(a,b)}
36226@r{ a@: H l n @: @: @:npfieldlevel@:(a)} 36223@r{ a@: H l n @: @: @:npfield@:(a)}
36227@r{ a b@: O H l n @: @: @:npfieldlevel@:(a,b)} 36224@r{ a b@: O H l n @: @: @:npfield@:(a,b)}
36228@r{ a@: l q @: @: @:powerquant@:(a)} 36225@r{ a@: l q @: @: @:lupquant@:(a)}
36229@r{ a b@: O l q @: @: @:powerquant@:(a,b)} 36226@r{ a b@: O l q @: @: @:lupquant@:(a,b)}
36230@r{ a@: H l q @: @: @:fieldquant@:(a)} 36227@r{ a@: H l q @: @: @:lufquant@:(a)}
36231@r{ a b@: O H l q @: @: @:fieldquant@:(a,b)} 36228@r{ a b@: O H l q @: @: @:lufquant@:(a,b)}
36232@r{ a@: l s @: @: @:spn@:(a)} 36229@r{ a@: l s @: @: @:spn@:(a)}
36233@r{ a@: l m @: @: @:midi@:(a)} 36230@r{ a@: l m @: @: @:midi@:(a)}
36234@r{ a@: l f @: @: @:freq@:(a)} 36231@r{ a@: l f @: @: @:freq@:(a)}