$SPAD/src/input ode.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

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

———-

A bug when one one uses a diff.eq. with a free variable other than x.

— * —

)set break resume
--S 1 of 11
y:=operator 'y
--R
--R
--R   (1)  y
--R                                                          Type: BasicOperator
--E 1
--S 2 of 11
deqx:= differentiate(y x,x,2)+differentiate(y x,x) +y x
--R
--R
--R         ,,       ,
--R   (2)  y  (x) + y (x) + y(x)
--R
--R                                                    Type: Expression(Integer)
--E 2
--S 3 of 11
solve(deqx,y,x) --OK
--R
--R
--R                                             x     x
--R                                     +-+   - -   - -      +-+
--R                                   x\|3      2     2    x\|3
--R   (3)  [particular= 0,basis= [cos(-----)%e   ,%e   sin(-----)]]
--R                                     2                    2
--IType: Union(Record(particular: Expression(Integer),basis: ...

--E 3
--S 4 of 11
solve(deqx,y,x=0,[1]) --OK
--R
--R
--R                      x
--R              +-+   - -
--R            x\|3      2
--R   (4)  cos(-----)%e
--R              2
--R                                         Type: Union(Expression(Integer),...)
--E 4
--S 5 of 11
deqt:= differentiate(y t,t,2)+differentiate(y t,t) +y t
--R
--R
--R         ,,       ,
--R   (5)  y  (t) + y (t) + y(t)
--R
--R                                                    Type: Expression(Integer)
--E 5
--S 6 of 11
solve(deqt,y,t) --OK
--R
--R
--R                                             t     t
--R                                     +-+   - -   - -      +-+
--R                                   t\|3      2     2    t\|3
--R   (6)  [particular= 0,basis= [cos(-----)%e   ,%e   sin(-----)]]
--R                                     2                    2
--IType: Union(Record(particular: Expression(Integer),basis: ...
--E 6
--S 7 of 11
solve(deqt,y,t=0,[1]) -- BUG!
--R
--R
--R                      t
--R              +-+   - -
--R            t\|3      2
--R   (7)  cos(-----)%e
--R              2
--R                                         Type: Union(Expression(Integer),...)
--E 7
--S 8 of 11
deqz:= differentiate(y z,z,2)+differentiate(y z,z) +y z

--R
--R
--R         ,,       ,
--R   (8)  y  (z) + y (z) + y(z)
--R
--R                                                    Type: Expression(Integer)
--E 8
--S 9 of 11
solve(deqz,y,z) --OK
--R
--R
--R                                             z     z
--R                                     +-+   - -   - -      +-+
--R                                   z\|3      2     2    z\|3
--R   (9)  [particular= 0,basis= [cos(-----)%e   ,%e   sin(-----)]]
--R                                     2                    2
--IType: Union(Record(particular: Expression(Integer),basis: ...
--E 9
--S 10 of 11
solve(deqz,y,z=0,[1]) -- BUG!
--R
--R
--R                       z
--R               +-+   - -
--R             z\|3      2
--R   (10)  cos(-----)%e
--R               2
--R                                         Type: Union(Expression(Integer),...)
--E 10

———-

I think the bug is in

   file odeef.spad
   constructor ODEEF
   function solve(diffeq:F,y:OP,center:EQ,y0:List F)

the second line of the body was

   kx:K:=kernel x

which uses uninitialised x. I think it should be

   kx:K:=kernel(retract(lhs(center))@SY)

as the line immediately below it. That change certainly fixes THIS bug!

Also, maybe a check should be made that this kx is indeed to be found in the diffeq – my system reports segmenttion violation if I do

— * —

--S 11 of 11 needs fixing
solve(deqt,y,x=0,[1])
--R
--R
--RDaly Bug
--R   >> Error detected within library code:
--R   parseODE: equation has order 0
--R
--R   Continuing to read the file...
--R
--E 11
)spool
)lisp (bye)

———-

References^{[1] nothing}

7