Jump to content

Arithmetic/Complex: Difference between revisions

Line 4,118:
Furthermore, the GPC defines a function <tt>conjugate</tt> so there is no need for writing such a custom function.
The PXSC, Pascal eXtensions for scientific computing, define a standard data type similar to [[#Free Pascal|Free Pascal’s]] <tt>ucomplex</tt> data type.
 
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
begin
var a := Cplx(1,2);
var b := Cplx(3,4);
Println(a + b);
Println(a - b);
Println(a * b);
Println(a / b);
Println(-a);
Println(1/a);
Println(a.Real,a.Imaginary);
Println(a.Conjugate);
Println(Abs(a));
Println(a ** b);
end.
</syntaxhighlight>
{{out}}
<pre>
(4 + i*6)
(-2 + i*-2)
(-5 + i*10)
(0.44 + i*0.08)
(-1 + i*-2)
(0.2 + i*-0.4)
1 2
(1 + i*-2)
2.23606797749979
(0.129009594074467 + i*0.0339240929051702)
</pre>
 
 
=={{header|Perl}}==
58

edits

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