From: Christian Bauer Date: Mon, 13 May 2002 20:21:57 +0000 (+0000) Subject: mentioned the imaginary unit 'I' X-Git-Tag: release_1-0-9~8 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=d8742494231a4f1baf0bfc09f5c09362ced8062f;ds=sidebyside mentioned the imaginary unit 'I' --- diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 2af37ad4..241de676 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -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