Complex conjugate: Difference between revisions
Content added Content deleted
(Start with Factor and Ruby.) |
(add Tcl) |
||
Line 20: | Line 20: | ||
# Numeric#conj or Numeric#conjugate returns self. |
# Numeric#conj or Numeric#conjugate returns self. |
||
puts 67.conjugate # 67</lang> |
puts 67.conjugate # 67</lang> |
||
=={{header|Tcl}}== |
|||
{{tcllib|math::complexnumbers}} |
|||
<lang tcl>package require math::complexnumbers |
|||
namespace import math::complexnumbers::* |
|||
foreach x {{2 3} {4 -5} {67 0}} { |
|||
set c [complex {*}$x] |
|||
puts "[tostring $c] conjucate is [tostring [conj $c]]" |
|||
}</lang> |
|||
Produces the output |
|||
<pre> |
|||
2+3i conjucate is 2-3i |
|||
4-5i conjucate is 4+5i |
|||
67 conjucate is 67</pre> |