/* Original version of this file copyright 1999 by Michael Wester,
 * and retrieved from http://www.math.unm.edu/~wester/demos/SpecialFunctions/problems.macsyma
 * circa 2006-10-23.
 *
 * Released under the terms of the GNU General Public License, version 2,
 * per message dated 2007-06-03 from Michael Wester to Robert Dodier
 * (contained in the file wester-gpl-permission-message.txt).
 *
 * See: "A Critique of the Mathematical Abilities of CA Systems"
 * by Michael Wester, pp 25--60 in
 * "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
 * and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
 */
/* ----------[ M a c s y m a ]---------- */
/* ---------- Initialization ---------- */
showtime: all$
prederror: false$
/* ---------- Special Functions ---------- */
/* Bernoulli numbers: B_16 => -3617/510   [Gradshteyn and Ryzhik 9.71] */
bern(16);
/* d/dk E(phi, k) => [E(phi, k) - F(phi, k)]/k  where  F(phi, k) and E(phi, k)
   are elliptic integrals of the 1st and 2nd kind, respectively
   [Gradshteyn and Ryzhik 8.123(3)] */
diff(elliptic_e(phi, k^2), k);
multthru(%);
/* Jacobian elliptic functions: d/du dn u => -k^2 sn u cn u
   [Gradshteyn and Ryzhik 8.158(3)] */
diff(jacobi_dn(u, k^2), u);
/* => -2 sqrt(pi)   [Gradshteyn and Ryzhik 8.338(3)] */
gamma(-1/2);
/* psi(1/3) => - Euler's_constant - pi/2 sqrt(1/3) - 3/2 log 3  where  psi(x)
   is the psi function [= d/dx log Gamma(x)]   [Gradshteyn and Ryzhik 8.366(6)]
   */
psi[0](1/3);
/* Bessel function of the first kind of order 2 => 0.04158 + 0.24740 i */
sfloat(bessel_j[2](1 + %i));
/* => 12/pi^2   [Gradshteyn and Ryzhik 8.464(6)] */
bessel_j[-5/2](%pi/2);
/* => sqrt(2/(pi z)) (sin z/z - cos z)   [Gradshteyn and Ryzhik 8.464(3)] */
bessel_j[3/2](z);
/* d/dz J_0(z) => - J_1(z)   [Gradshteyn and Ryzhik 8.473(4)] */
diff(bessel_j[0](z), z);
/* Associated Legendre (spherical) function of the 1st kind: P^mu_nu(0)
   => 2^mu sqrt(pi) / [Gamma([nu - mu]/2 + 1) Gamma([- nu - mu + 1]/2)]
      [Gradshteyn and Ryzhik 8.756(1)] */
declare(nu, integer, mu, integer)$
assume(nu > mu)$
alegendre_p(nu, mu, 0);
forget(nu > mu)$
remove(nu, integer, mu, integer)$
/* P^1_3(x) => -3/2 sqrt(1 - x^2) (5 x^2 - 1)
               [Gradshteyn and Ryzhik 8.813(4)] */
alegendre_p(3, 1, x);
/* nth Chebyshev polynomial of the 1st kind: T_n(x) => 0
   [Gradshteyn and Ryzhik 8.941(1)] */
ratsimp(chebyshev_t(1008, x) - 2*x*chebyshev_t(1007, x) + chebyshev_t(1006, x));
/* T_n(-1) => (-1)^n   [Gradshteyn and Ryzhik 8.944(2)] */
declare(n, integer)$
assume(n > 0)$
chebyshev_t(n, -1);
forget(n > 0)$
assume(equal(n, 0))$
chebyshev_t(n, -1);
forget(equal(n, 0))$
assume(n < 0)$
chebyshev_t(n, -1);
forget(n < 0)$
remove(n, integer)$
/* => arcsin z/z   [Gradshteyn and Ryzhik 9.121(26)] */
hgfred([1/2, 1/2], [3/2], z^2);
/* => sin(n z)/(n sin z cos z)   [Gradshteyn and Ryzhik 9.121(17)] */
q: hgfred([(n + 2)/2, -(n - 2)/2], [3/2], sin(z)^2);
assume(cos(z) > 0)$
ev(trigreduce(trigsimp(q)), triginverses:all);
forget(cos(z) > 0)$
remvalue(q)$
/* zeta'(0) => - 1/2 log(2 pi)   [Gradshteyn and Ryzhik 9.542(4)] */
subst(x = 0, diff(zeta(x), x));
logcontract(%);
/* Dirac delta distribution => 3 f(4/5) + g'(1) */
integrate(f((x + 2)/5)*delta((x - 2)/3) - g(x)*diff(delta(x - 1), x), x, 0, 3);
delint(f((x + 2)/5)*delta((x - 2)/3) - g(x)*diff(delta(x - 1), x), x, 0, 3);
deltasimp(%, x);
/* Define an antisymmetric function f */
declare(f, antisymmetric)$
/* Test it out => [-f(a, b, c), 0] */
[f(c, b, a), f(c, b, c)];
remove(f, antisymmetric)$
/* ---------- Quit ---------- */
quit();
