Arithmetic/Complex: Difference between revisions
Content added Content deleted
(→{{header|Factor}}: use recip instead of 1 swap /) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 203: | Line 203: | ||
The linked image gives a few examples of complex arithmetic and a custom complex conjugate function.<br> |
The linked image gives a few examples of complex arithmetic and a custom complex conjugate function.<br> |
||
[https://lh4.googleusercontent.com/-4M57lWIh_r8/Uuqgoec-hrI/AAAAAAAAJ74/2oj_5eelUR4/w1197-h766-no/Capture.PNG View the blocks and app screen...] |
[https://lh4.googleusercontent.com/-4M57lWIh_r8/Uuqgoec-hrI/AAAAAAAAJ74/2oj_5eelUR4/w1197-h766-no/Capture.PNG View the blocks and app screen...] |
||
=={{header|Arturo}}== |
|||
<lang rebol>a: to :complex [1 1] |
|||
b: to :complex @[pi 1.2] |
|||
print ["a:" a] |
|||
print ["b:" b] |
|||
print ["a + b:" a + b] |
|||
print ["a * b:" a * b] |
|||
print ["1 / a:" 1 / a] |
|||
print ["neg a:" neg a] |
|||
print ["conj a:" conj a]</lang> |
|||
{{out}} |
|||
<pre>a: 1.0+1.0i |
|||
b: 3.141592653589793+1.2i |
|||
a + b: 4.141592653589793+2.2i |
|||
a * b: 1.941592653589793+4.341592653589793i |
|||
1 / a: 0.5-0.5i |
|||
neg a: -1.0-1.0i |
|||
conj a: 1.0-1.0i</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |