Jump to content

Complex conjugate: Difference between revisions

add Tcl
(Start with Factor and Ruby.)
 
(add Tcl)
Line 20:
# Numeric#conj or Numeric#conjugate returns self.
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>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.