]> www.ginac.de Git - ginac.git/commitdiff
mentioned the imaginary unit 'I'
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 13 May 2002 20:22:25 +0000 (20:22 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 13 May 2002 20:22:25 +0000 (20:22 +0000)
doc/tutorial/ginac.texi

index 717d5b107909c665b06ad461cd98aded5bfcc4c8..ac4fd5843976562946cffa96fec73ecdbf107340 100644 (file)
@@ -931,10 +931,22 @@ int main()
     numeric trott("1.0841015122311136151E-2");
     
     std::cout << two*p << std::endl;  // floating point 6.283...
+    ...
+@end example
+
+@cindex @code{I}
+@cindex complex numbers
+The imaginary unit in GiNaC is a predefined @code{numeric} object with the
+name @code{I}:
+
+@example
+    ...
+    numeric z1 = 2-3*I;                    // exact complex number 2-3i
+    numeric z2 = 5.9+1.6*I;                // complex floating point number
 @}
 @end example
 
-It may be tempting to construct numbers writing @code{numeric r(3/2)}.
+It may be tempting to construct fractions by writing @code{numeric r(3/2)}.
 This would, however, call C's built-in operator @code{/} for integers
 first and result in a numeric holding a plain integer 1.  @strong{Never
 use the operator @code{/} on integers} unless you know exactly what you