Am Dienstag, den 07.04.2009, 12:14 -0700 schrieb Edwin Woollett:
> bfloat ( erf (z) ) seems to not be as powerful as float ( erf (z) ),
> based on the following comparison:
> (windows xp, xmaxima, Maxima 5.18.0 )
> ---------------------------------------------------------
> (%i1) ( fpprintprec : 8, display2d : false )$
>
> (%i2) i2val : sqrt(%pi)*erf ( sqrt (2)*%i + sqrt (2) )$
>
> /* first use expand float (..) */
>
> (%i3) expand ( float (i2val) );
> (%o3) 1.7907309 - 0.485521*%i
> /* above is short and sweet */
>
> /* now use expand bfloat(...) */
> (%i4) expand ( bfloat (i2val) ), fpprec : 20;
> (%o4) 9.2292292b - 1*%i*sin (0.25*%pi) + 1.6095529b0*sin (0.25*%pi)
> - 1.6095529b0*%i*cos (0.25*%pi)
> + 9.2292292b-1*cos (0.25*%pi)
>
> /* bfloat doesn't follow through with crunching %pi args
> so we need another pass */
>
> (%i5) bfloat (%), fpprec : 20;
> (%o5) 1.7907308b0 - 4.8552076b-1*%i
>
> ----------------------
> Is it possible to improve bfloat to get automatic conversion to
> bigfloat of stuff like cos(0.25*%pi) ?
>
> Also, why hasn't the " 0.25 " inside the trig function been converted to a
> bigfloat in
> the first pass?
Hello Ted,
thank you for the report.
The problem is the numerical routine of the erf function for complex
bigfloat values. The constants are not completely converted to
bigfloats. Later in the calculation we get the terms you have observed.
I have improved the numerical routine and will commit the change. These
are the results with the improvements:
(%i2) arg:sqrt(2)+%i*sqrt(2);
(%o2) sqrt(2)*%i+sqrt(2)
(%i3) erf(arg);
(%o3) erf(sqrt(2)*%i+sqrt(2))
(%i4) erf(arg),float;
(%o4) 1.010311712025489-0.27392575946354*%i
(%i5) erf(arg),bfloat;
(%o5) 1.01031171202549b0-2.7392575946354b-1*%i
Dieter Kaiser