Arithmetic/Complex: Difference between revisions

(CoffeeScript)
Line 633:
quotient = product.times inverse
console.log "(#{product}) / (#{b}) = #{quotient}"
</lang>
 
output
<lang>
> coffee complex.coffee
(5 + 3i) + (4 - 3i) = 9
(5 + 3i) * (4 - 3i) = 29 - 3i
-1 * (4 - 3i) = -4 + 3i
(5 + 3i) - (4 - 3i) = 1 + 6i
1 / (4 - 3i) = 0.16 + 0.12i
(29 - 3i) / (4 - 3i) = 5 + 3i
</lang>
 
Anonymous user