$SPAD/src/input opalg.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool opalg.output
)set message test on
)set message auto off
)clear all

———-

This is the recursive definition of the Legendre polynomials — * —

--S 1 of 9
L n ==
  n = 0 => 1
  n = 1 => x
  (2*n-1)/n * x * L(n-1) - (n-1)/n * L(n-2)
--R
--R                                                                   Type: Void
--E 1
--S 2 of 9
L 5
--R
--R   Compiling function L with type Integer -> Polynomial(Fraction(
--R      Integer))
--R   Compiling function L as a recurrence relation.
--R
--R        63  5   35  3   15
--R   (2)  -- x  - -- x  + -- x
--R         8       4       8
--R                                          Type: Polynomial(Fraction(Integer))
--E 2

———-

Create the differential operator d/dx on Q[x] — * —

--S 3 of 9
dx := operator("D")::OP(POLY FRAC INT)

--R
--R
--R   (3)  D
--R                                Type: Operator(Polynomial(Fraction(Integer)))
--E 3

———-

And attach the map d/dx to it:

— * —

--S 4 of 9
evaluate(dx, p +-> differentiate(p, 'x))$OP(POLY FRAC INT)
--R
--R
--R   (4)  D
--R                                Type: Operator(Polynomial(Fraction(Integer)))
--E 4

———-

This is the differential equation satisfied by the nth Legendre poly:

— * —

--S 5 of 9
E n == (1 - x**2) * dx**2 - 2 * x * dx + n*(n+1)
--R
--R                                                                   Type: Void
--E 5
--S 6 of 9
E 5
--R
--R   Compiling function E with type PositiveInteger -> Operator(
--R      Polynomial(Fraction(Integer)))
--R
--R                      2      2
--R   (6)  30 - 2x D - (x  - 1)D
--R                                Type: Operator(Polynomial(Fraction(Integer)))
--E 6
--S 7 of 9
[L i for i in 1..10]
--R
--R
--R   (7)
--R       3  2   1  5  3   3    35  4   15  2   3  63  5   35  3   15
--R   [x, - x  - -, - x  - - x, -- x  - -- x  + -, -- x  - -- x  + -- x,
--R       2      2  2      2     8       4      8   8       4       8
--R    231  6   315  4   105  2    5  429  7   693  5   315  3   35
--R    --- x  - --- x  + --- x  - --, --- x  - --- x  + --- x  - -- x,

--R     16       16       16      16   16       16       16      16
--R    6435  8   3003  6   3465  4   315  2    35
--R    ---- x  - ---- x  + ---- x  - --- x  + ---,
--R     128       32        64        32      128
--R    12155  9   6435  7   9009  5   1155  3   315
--R    ----- x  - ---- x  + ---- x  - ---- x  + --- x,
--R     128        32        64        32       128
--R    46189  10   109395  8   45045  6   15015  4   3465  2    63
--R    ----- x   - ------ x  + ----- x  - ----- x  + ---- x  - ---]
--R     256          256        128        128        256      256
--R                                    Type: List(Polynomial(Fraction(Integer)))
--E 7
--S 8 of 9
[E i for i in 1..10]
--R
--R
--R   (8)
--R                 2      2               2      2                2      2
--R   [2 - 2x D - (x  - 1)D , 6 - 2x D - (x  - 1)D , 12 - 2x D - (x  - 1)D ,
--R                  2      2                2      2                2      2
--R    20 - 2x D - (x  - 1)D , 30 - 2x D - (x  - 1)D , 42 - 2x D - (x  - 1)D ,
--R                  2      2                2      2                2      2
--R    56 - 2x D - (x  - 1)D , 72 - 2x D - (x  - 1)D , 90 - 2x D - (x  - 1)D ,
--R                   2      2
--R    110 - 2x D - (x  - 1)D ]
--R                          Type: List(Operator(Polynomial(Fraction(Integer))))
--E 8
--S 9 of 9
[(E i)(L i) for i in 1..10]
--R
--R
--R   (9)  [0,0,0,0,0,0,0,0,0,0]
--R                                    Type: List(Polynomial(Fraction(Integer)))
--E 9
)spool
)lisp (bye)

———-

References^{[1] nothing}

6