On Oct. 20, Barton Willis wrote:
> Maxima won't win a speed contest for numerical evaluation of struve_h,
> but at least the
> value of struve_h(0, 1000.0b0) agrees with Wolfram alpha:
>
> (%i11) fpprec : 56$
>
> Takes about 2 seconds on my i3:
>
> (%i12) struve_h(0, 1000.0b0), max_fpprec : 10000;
> (%o12) 5.3525371133763518099863310575438959362152058389955848882b-3
>
> Wolfram alpha (input StruveH[0,1000])
>
> (%i13) 0.0053525371133763518099863310575438959362152058389955848882b0$
>
> (%i14) (%-%o12)/%;
> (%o14) -5.580619564334294774727172516159399253437892869615357299b-57
>
> For numerical evaluation, the hypergeometric code only uses convergent
> power series--it
> uses no divergent asymptotic expansions. I think there is a useful
> divergent expansion
> for struve_h(0,x) for x --> infinity.
>
> I suppose the message "fpprec.Exceeded maximum allowed" could be
> changed to a suggestion
> to increase max_fpprec. It's sad that the message is printed multiple
> times, but avoiding
> that is hard, I think.
Using your bfloat settings I can get the x=1000 value of struve_h,
but the x = 10000 value, which I really need here is *very* slow
and eventually chokes as before with the same messages.
By the way, I actually just tried out float after making the
bfloat settings, and got a wildly wrong answer:
-----------------------------------------
(%i1) (fpprec : 56,max_fpprec : 10000)$
(%i2) float(struve_h(0,10));
(%o2) 0.11874368368744 ok
(%i3) display2d:false$
(%i4) float(struve_h(0,100));
(%o4) -7.2734918013969798E+23 ***not ok***
(%i5) float(struve_h(0,1000));
(%o5) 0.0053525371133764 ok
(%i6) bfloat(struve_h(0,10));
(%o6) 1.1874368368746126813851171788439396082759728213500596715b-1
(%i7) bfloat(struve_h(0,100));
(%o7) -7.0878751689647343204031978078193626498395291968345567579b-2
(%i8) bfloat(struve_h(0,1000));
(%o8) 5.3525371133763518099863310575438959362152058389955848882b-3
----------------------------------
Does the bfloat set operation then make ordinary float
unreliable (even though float is not supposed to
use a fpprec setting in the first place)??
In any case, the present special function behavior for
numerical evaluation implies (for my nint project) that
my code should search for the presence of struve_h
functions in any output of integrate (which is automatically
used as a first attempt (unless a flag is changed) and
then interrogate the arguments to exclude the chance
of attempting numerical evaluation in cases such
as occur, for example, in the expression of interest:
..........................................................
-2*bessel_y(2,10000) + (4*bessel_y(2,1)
- %pi*struve_h(0,1)*bessel_y(1,1)
- %pi*struve_h(-1,1)*bessel_y(0,1))/2
+ 5000*%pi*struve_h(0,10000)*bessel_y(1,10000)
+ 5000*%pi*struve_h(-1,10000)*bessel_y(0,10000)
............................................................
The other lesson learned, perhaps, is that I should routinely
use blfloat in the nint code, instead of float, and routinely
set fpprec:20 say (I am not interested in high precision
answers at this stage of the project).
Ted