From: Richard Kreckel Date: Mon, 13 Mar 2000 17:12:12 +0000 (+0000) Subject: - New example in Tour of GiNaC about exact radicals. X-Git-Tag: release_0-5-4~12 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=967f91512ca4415df4950ae9cc5cd5d524e6edca;hp=83c1a0ba18b918a02fea05272d6e9e514880b707 - New example in Tour of GiNaC about exact radicals. --- diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index d4ab7fb5..a47e7cad 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -280,8 +280,23 @@ integers: 1/3 @end example -All numbers occuring in GiNaC's expressions can be converted into floating -point numbers with the @code{evalf} method, to arbitrary accuracy: +Exact numbers are always retained as exact numbers and only evaluated as +floating point numbers if requested. For instance, with numeric +radicals is dealt pretty much as with symbols. Products of sums of them +can be expanded: + +@example +> expand((1+a^(1/5)-a^(2/5))^3); +1+3*a+3*a^(1/5)-5*a^(3/5)-a^(6/5) +> expand((1+3^(1/5)-3^(2/5))^3); +10-5*3^(3/5) +> evalf((1+3^(1/5)-3^(2/5))^3); +0.33408977534118624238 +@end example + +The function @code{evalf} that was used above converts any number in +GiNaC's expressions into floating point numbers. This can be done to +arbitrary predefined accuracy: @example > evalf(1/7);