Alasdair McAndrew wrote:
>
> If you start a new FriCAS, and then enter:
>
> (1) -> digits 10
> (2) -> complexSolve(x^3-6*x-6=0,1.e-10)
>
> you obtain
>
> [x= 2.8473221018_6307233001_9122091471_217572689 - 0.4188072111 E -10 %i,
> x= - 1.423661051 - 0.283606001 %i,
> x= - 1.423661051 + 0.2836060010_2688149348_7508123507_7232122421 %i]
>
> which as you see contains floating point values with far more the the
> requested 10 digits. How can I ensure that all real and imaginary parts of
> the solution are displayed with only the 10 digits I want?
>
This probably should be in FAQ: 'digits' mean that floating point
routines try to obtain given accuracy. Obtaining given accuracy
of final result typically involves using more accurate intermediate
results. The eps argument to 'complexSolve' means that
absolute error of solutions should be less than eps. Equation
solving is notoriusly unstable, so usually requires extra
precision. In your case the eps argument effectively overrides
'digits' setting: it is impossible to get 10 digit accuracy
of solutions using only 10 digit arithmetic. Old code used too
small precision, and returned inaccurate results. In this case
old code give error which is 30% too large. You can probably
accept such error and try to correct it with some fuzz factor
in eps. However sometimes error was much larger than eps.
FriCAS fixed this problem, by using more precision. It is
hard to a priori decide how much precision in intermediate
calculation is needed, so FriCAS is frequently too cautious
and uses more digits than necessary.
Another question is how many digits present in final answer.
For printing there are routines like 'outputFixed' to
control form of printed results. By default FriCAS prints
all digits of internal represention. And 'complexSolve'
returns all digits that it computed. That is somewhat
debatable. Rationale for current behaviour is that
frequently results are more accurate than requested and
this extra accuracy can help in further computation.
Trimming extra digits would discard part of already done
work. We could try to keep only digits that are
significant, but that requires extra effort. Also to
minimize rounding error in longer calculations it makes
sense to keep a few (say 3) non-significant digits.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.