Jump to content

Arithmetic/Complex: Difference between revisions

Added Arturo implementation
(→‎{{header|Factor}}: use recip instead of 1 swap /)
(Added Arturo implementation)
Line 203:
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...]
 
=={{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}}==
1,532

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.