16.10 ``Special functions'' in Sage

Sage has several special functions:

and orthogonal polynomials

In Sage these are restricted to numerical evaluation and plotting but via maxima, some symbolic manipulationis allowed:

sage: maxima.eval("f:bessel_y (v, w)")
'?%bessel_y(v,w)'
sage: maxima.eval("diff(f,w)")
'(?%bessel_y(v-1,w)-?%bessel_y(v+1,w))/2'
sage: maxima.eval("diff (jacobi_sn (u, m), u)")
'?%jacobi_cn(u,m)*?%jacobi_dn(u,m)'
sage: jsn = lambda x: jacobi("sn",x,1)
sage: P = plot(jsn,0,1, plot_points=20); Q = plot(lambda x:bessel_Y( 1, x), 1/2,1)
sage: show(P)
sage: show(Q)

In addition to maxima, pari and octave also have special functions (in fact, some of pari's special functions are wrapped in Sage).

Here's an example using Sage's interface (located in sage/interfaces/octave.py) with octave (http://www.octave.org/doc/index.html).

sage: octave("atanh(1.1)")   ## requires optional octave
(1.52226,-1.5708)

Here's an example using Sage's interface to pari's special functions.

sage: pari('2+I').besselk(3)
0.04559077184075505871203211094 + 0.02891929465820812820828883526*I     # 32-bit
0.045590771840755058712032110938791854704 + 0.028919294658208128208288835257608789842*I   # 64-bit
sage: pari('2').besselk(3)  # random
0.061510458471742038

The last command can also be executed using the Sage command

sage: bessel_K(3,2)
0.647385390948634
sage: bessel_K(3,2,prec=100)
0.64738539094863415315923557097

See About this document... for information on suggesting changes.