Arithmetic/Complex: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added demo of CMath lib)
m (→‎{{header|Sidef}}: modified code to work with Sidef 2.10)
Line 3,841: Line 3,841:
a * b, # multiplication
a * b, # multiplication
-a, # negation
-a, # negation
1c / a, # multiplicative inverse
1.c / a, # multiplicative inverse
~a, # complex conjugate
~a, # complex conjugate
a.abs, # abs
a.abs, # abs
Line 3,847: Line 3,847:
b.re, # real
b.re, # real
b.im, # imaginary
b.im, # imaginary
].each { |c| say c };</lang>
].each { |c| say c }</lang>
{{out}}
{{out}}
<pre>4.14159+2.25i
<pre>4.14159+2.25i