Complex (function): Difference between revisions

Jump to navigation Jump to search
100 bytes added ,  14:24, 10 August 2022
→‎History: Link and section for Hui's design exercises, and make it clear the next part is from another source
(History)
(→‎History: Link and section for Hui's design exercises, and make it clear the next part is from another source)
Line 3: Line 3:
== History ==
== History ==


The question of whether to include this function is one of [[Roger Hui]]'s 50 exercises in APL language design<ref>[[Roger Hui]]. Some Exercises in APL Language Design. Jsoftware. 2016.</ref>:
The question of whether to include this function is one of [[Roger Hui]]'s 50 exercises in APL language design:<ref>[[Roger Hui]]. [https://www.jsoftware.com/papers/APLDesignExercises.htm Some Exercises in APL Language Design]. §8 Imaginary/Complex and sample answer. Jsoftware. 2016.</ref>
<blockquote>Complex numbers can be constructed as ordered pairs of real numbers, similar to how integers can be constructed as ordered pairs of natural numbers and rational numbers as ordered pairs of integers. For complex numbers, <source lang=j inline>j.</source> plays the same role as <source lang=apl inline>-</source> for integers and <source lang=apl inline>÷</source> for rational numbers. </blockquote>
<blockquote>Complex numbers can be constructed as ordered pairs of real numbers, similar to how integers can be constructed as ordered pairs of natural numbers and rational numbers as ordered pairs of integers. For complex numbers, <source lang=j inline>j.</source> plays the same role as <source lang=apl inline>-</source> for integers and <source lang=apl inline>÷</source> for rational numbers. </blockquote>
Hui goes on to quote [[Adám Brudzewsky]]:<ref>[[Roger Hui|Hui, Roger]]. [https://forums.dyalog.com/viewtopic.php?f=30&t=1786&p=7020&hilit=complex+imaginary#p7020 ⊕ and ⊗]. Dyalog Forums. 13 Jul 2021.</ref>
In a later blog post, Hui quoted [[Adám Brudzewsky]]:<ref>[[Roger Hui]]. [https://forums.dyalog.com/viewtopic.php?f=30&t=1786&p=7020&hilit=complex+imaginary#p7020 ⊕ and ⊗]. Dyalog Forums. 2021-06-13.</ref>
<blockquote>(…) I’d probably go for <source lang=apl inline>⊕</source> because:
<blockquote>(…) I’d probably go for <source lang=apl inline>⊕</source> because:


Line 21: Line 21:
Moreover, complex numbers are commonly represented by magnitude and phase. So if you have a magnitude and phase, how do you get the number so represented? Why <source lang=apl inline>k←{⍺←1 ⋄ ⍺×*0j1×⍵}</source> (or <source lang=apl inline>{⍺←1 ⋄ ⍺×*⊕⍵}</source>) of course. And what symbol would you use? <source lang=apl inline>⊗</source> (Monadic <source lang=apl inline>⊗</source>, with a default magnitude of 1, gets you a point on the unit circle.)
Moreover, complex numbers are commonly represented by magnitude and phase. So if you have a magnitude and phase, how do you get the number so represented? Why <source lang=apl inline>k←{⍺←1 ⋄ ⍺×*0j1×⍵}</source> (or <source lang=apl inline>{⍺←1 ⋄ ⍺×*⊕⍵}</source>) of course. And what symbol would you use? <source lang=apl inline>⊗</source> (Monadic <source lang=apl inline>⊗</source>, with a default magnitude of 1, gets you a point on the unit circle.)
</blockquote>
</blockquote>
== Examples ==
== Examples ==


Navigation menu