4,494
edits
m (Text replacement - "<source" to "<syntaxhighlight") Tags: Mobile edit Mobile web edit |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 1: | Line 1: | ||
:''This page describes the dyadic arithmetic function. For the monadic natural logarithm function, see [[Natural Logarithm]].'' | :''This page describes the dyadic arithmetic function. For the monadic natural logarithm function, see [[Natural Logarithm]].'' | ||
{{Built-in|Logarithm|⍟}}, or '''Log''', is a [[dyadic]] [[scalar function]] which computes the [[wikipedia:logarithm|logarithm]] of the two [[argument|arguments]]. More precisely, <syntaxhighlight lang=apl inline>X⍟Y</ | {{Built-in|Logarithm|⍟}}, or '''Log''', is a [[dyadic]] [[scalar function]] which computes the [[wikipedia:logarithm|logarithm]] of the two [[argument|arguments]]. More precisely, <syntaxhighlight lang=apl inline>X⍟Y</syntaxhighlight> computes how much [[power]] of X equals Y, i.e. the value of R that satisfies <syntaxhighlight lang=apl inline>Y=X*R</syntaxhighlight>. Logarithm shares the [[glyph]] <syntaxhighlight lang=apl inline>⍟</syntaxhighlight> with the monadic arithmetic function [[Natural Logarithm]]. The [[glyph]], a composition of the glyphs for [[Circular]] (<syntaxhighlight lang=apl inline>○</syntaxhighlight>) and [[Power]] (<syntaxhighlight lang=apl inline>*</syntaxhighlight>) to indicate its close mathematical ties with these two functions, is a stylised tree log.<ref>[[E. E. McDonnell|McDonnell, E. E.]]. [https://www.jsoftware.com/papers/eem/storyofo.htm Recreational APL: The Story of <syntaxhighlight lang=apl inline>○</syntaxhighlight>]. [[APL Quote-Quad]], Volume 8, Number 2, 1977-12.</ref> | ||
== Examples == | == Examples == | ||
Line 8: | Line 8: | ||
2⍟0.5 1 2 32 1024 | 2⍟0.5 1 2 32 1024 | ||
¯1 0 1 5 10 | ¯1 0 1 5 10 | ||
</ | </syntaxhighlight> | ||
Logarithm can be used to determine how many digits are needed to write a positive integer Y in base X: | Logarithm can be used to determine how many digits are needed to write a positive integer Y in base X: | ||
Line 23: | Line 23: | ||
│3│1 0 0│ | │3│1 0 0│ | ||
└─┴─────┘ | └─┴─────┘ | ||
</ | </syntaxhighlight>{{Works in|[[Dyalog APL]]}} | ||
== Properties == | == Properties == | ||
Line 36: | Line 36: | ||
2 (*⍣¯1 ≡ ⍟) ⍳10 | 2 (*⍣¯1 ≡ ⍟) ⍳10 | ||
1 | 1 | ||
</ | </syntaxhighlight>{{Works in|[[Dyalog APL]]}} | ||
[[Reciprocal]] on the left or right argument gives the [[negate|negated]] result. | [[Reciprocal]] on the left or right argument gives the [[negate|negated]] result. | ||
Line 45: | Line 45: | ||
(÷2)⍟2 4 8 16 32 | (÷2)⍟2 4 8 16 32 | ||
¯1 ¯2 ¯3 ¯4 ¯5 | ¯1 ¯2 ¯3 ¯4 ¯5 | ||
</ | </syntaxhighlight> | ||
== See also == | == See also == |