====================================================================
LinearOrdinaryDifferentialOperator examples
====================================================================

LinearOrdinaryDifferentialOperator(A, diff) is the domain of linear
ordinary differential operators with coefficients in a ring A with a
given derivation.

====================================================================
Differential Operators with Series Coefficients
====================================================================

Problem:
  Find the first few coefficients of exp(x)/x^i of Dop phi where

    Dop := D^3 + G/x^2 * D + H/x^3 - 1
    phi := sum(s[i]*exp(x)/x^i, i = 0..)

Solution:

Define the differential.

  Dx: LODO(EXPR INT, f +-> D(f, x))
                         Type: Void

  Dx := D()
   D
     Type: LinearOrdinaryDifferentialOperator(Expression Integer,
      theMap LAMBDA-CLOSURE(NIL,NIL,NIL,G1404 envArg,
              SPADCALL(G1404,QUOTE x,
               ELT(*1;anonymousFunction;0;frame0;internal;MV,0))))

Now define the differential operator Dop.

  Dop:= Dx^3 + G/x^2*Dx + H/x^3 - 1
                       3
     3    G     - x  + H
    D  + -- D + --------
          2         3
         x         x
     Type: LinearOrdinaryDifferentialOperator(Expression Integer,
      theMap LAMBDA-CLOSURE(NIL,NIL,NIL,G1404 envArg,
              SPADCALL(G1404,QUOTE x,
               ELT(*1;anonymousFunction;0;frame0;internal;MV,0))))

  n == 3
                          Type: Void

  phi == reduce(+,[subscript(s,[i])*exp(x)/x^i for i in 0..n])
                          Type: Void

  phi1 ==  Dop(phi) / exp x
                          Type: Void

  phi2 == phi1 *x**(n+3)
                          Type: Void

  phi3 == retract(phi2)@(POLY INT)
                          Type: Void

  pans == phi3 ::UP(x,POLY INT)
                          Type: Void

  pans1 == [coefficient(pans, (n+3-i) :: NNI) for i in 2..n+1]
                          Type: Void

  leq == solve(pans1,[subscript(s,[i]) for i in 1..n])
                          Type: Void

Evaluate this for several values of n.

  leq
                          2                                3        2
        s G     3s H + s G  + 6s G     (9s G + 54s )H + s G  + 18s G  + 72s G
         0        0     0       0         0       0      0        0        0
  [[s = ---,s = ------------------,s = --------------------------------------]]
     1   3   2          18          3                    162
                         Type: List List Equation Fraction Polynomial Integer

  n==4
                          Type: Void

  leq
   [
                             2
          s G      3s H + s G  + 6s G
           0         0     0       0
     [s = ---, s = ------------------,
       1   3    2          18
                              3        2
          (9s G + 54s )H + s G  + 18s G  + 72s G
             0       0      0        0        0
      s = --------------------------------------,
       3                    162

       s  =
        4
                  2         2                          4        3         2
             27s H  + (18s G  + 378s G + 1296s )H + s G  + 36s G  + 396s G
                0         0         0         0      0        0         0
           + 
             1296s G
                  0
        /
           1944
       ]
     ]
                         Type: List List Equation Fraction Polynomial Integer

  n==7
                          Type: Void

  leq
   [
                             2
          s G      3s H + s G  + 6s G
           0         0     0       0
     [s = ---, s = ------------------,
       1   3    2          18
                              3        2
          (9s G + 54s )H + s G  + 18s G  + 72s G
             0       0      0        0        0
      s = --------------------------------------,
       3                    162

       s  =
        4
                  2         2                          4        3         2
             27s H  + (18s G  + 378s G + 1296s )H + s G  + 36s G  + 396s G
                0         0         0         0      0        0         0
           + 
             1296s G
                  0
        /
           1944
       ,

       s  =
        5
                               2         3          2
             (135s G + 2268s )H  + (30s G  + 1350s G  + 16416s G + 38880s )H
                  0         0          0          0           0          0
           + 
                5        4          3          2
             s G  + 60s G  + 1188s G  + 9504s G  + 25920s G
              0        0          0          0           0
        /
           29160
       ,

       s  =
        6
                   3          2                        2
             405s H  + (405s G  + 18468s G + 174960s )H
                 0          0           0           0
           + 
                   4          3           2                                6
             (45s G  + 3510s G  + 88776s G  + 777600s G + 1166400s )H + s G
                 0          0           0            0            0      0
           + 
                  5          4           3           2
             90s G  + 2628s G  + 27864s G  + 90720s G
                0          0           0           0
        /
           524880
       ,

       s  =
        7
                                 3
             (2835s G + 91854s )H
                   0          0
           + 
                    3           2                            2
             (945s G  + 81648s G  + 2082996s G + 14171760s )H
                  0           0             0             0
           + 
                   5          4            3             2
             (63s G  + 7560s G  + 317520s G  + 5554008s G  + 34058880s G)H
                 0          0            0             0              0
           + 
                7         6          5           4             3              2
             s G  + 126s G  + 4788s G  + 25272s G  - 1744416s G  - 26827200s G
              0         0          0           0             0              0
           + 
             - 97977600s G
                        0
        /
           11022480
       ]
     ]
                         Type: List List Equation Fraction Polynomial Integer

See Also:
o )show LinearOrdinaryDifferentialOperator

