From d8742494231a4f1baf0bfc09f5c09362ced8062f Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 13 May 2002 20:21:57 +0000 Subject: [PATCH] mentioned the imaginary unit 'I' --- doc/tutorial/ginac.texi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- 2.38.1