feature request: imagpart (bessel_y)
- Subject: feature request: imagpart (bessel_y)
- From: Edwin Woollett
- Date: Thu, 10 Nov 2011 12:00:18 -0800
Maxima knows that imagpart ( bessel_j(1,x)) is
identically zero (since x is by default real).
This allows much faster use of quad_qag
via nint, as shown below, as compared with
the analogous calculation for bessel_y.
In the following, details=true, so information
about method appears.
----------------------------------
(%i1) load(nint);
(%o1) "c:/work2/nint.mac"
/* case bessel_j */
(%i2) imagpart(bessel_j(1,x));
(%o2) 0
(%i3) imagpart(bessel_j(2,sqrt(2)*x));
(%o3) 0
(%i4) nint(bessel_j(1,x)*bessel_j(2,sqrt(2)*x),x,1,1000,strong_osc);
quad_qag
(%o4) 0.47382488780922
(%i5) time(%);
(%o5) [6.42]
(%i6) goutL;
(%o6) [[qag,0.47382488780922,3.0088677226459195E-9,7843,0]]
(%i7) gargL;
(%o7) [[qag,bessel_j(1,x)*bessel_j(2,sqrt(2)*x),x,1,1000,3,epsrel = 1.0E-8,
limit = 700]]
/* case bessel_y */
(%i8) imagpart(bessel_y(1,x));
(%o8) 'imagpart(bessel_y(1,x))
(%i9) imagpart(bessel_y(2,sqrt(2)*x));
(%o9) 'imagpart(bessel_y(2,sqrt(2)*x))
(%i10) nint(bessel_y(1,x)*bessel_y(2,sqrt(2)*x),x,1,1000,strong_osc);
quad_qag
(%o10) 0.44737052335548
(%i11) time(%);
(%o11) [19.78]
(%i12) goutL;
(%o12) [[[qag,0.44737052335548,3.0438548004320586E-9,7905,0],
[qag,0.0,0.0,31,0]]]
(%i13) gargL;
(%o13) [[[qag,
'realpart(bessel_y(1,x))*'realpart(bessel_y(2,sqrt(2)*x))
-'imagpart(bessel_y(1,x))*'imagpart(bessel_y(2,sqrt(2)*x)),x,1,
1000,3,epsrel = 1.0E-8,limit = 700],
[qag,
'imagpart(bessel_y(1,x))*'realpart(bessel_y(2,sqrt(2)*x))
+'realpart(bessel_y(1,x))*'imagpart(bessel_y(2,sqrt(2)*x)),x,1,
1000,3,epsrel = 1.0E-8,limit = 700]]]
-----------------------------------------------------------
Hence the feature request:
Add imagpart knowledge to bessel_y code
and simplification.
Ted Woollett