1/* Filename hill2.mac
2
3   ***************************************************************
4   *							         *
5   *                     <package name>                          *
6   *                <functionality description>                  *
7   *                                                             *
8   *          from: Computer Algebra in Applied Math.            *
9   *                   by Rand (Pitman,1984)                     *
10   *                Programmed by Richard Rand                   *
11   *      These files are released to the public domain          *
12   *            						 *
13   ***************************************************************
14*/ /*
15(d4) This program generates the transition curves in
16
17
18Mathieu's equation via Hill's determinants.  Call it by
19
20
21typing:
22
23
24                       HILL()
25
26
27NOTE: File HILL1.MAC must be loaded before calling HILL().
28
29*/
30
31hill():=(input(),
32     if evenp(n) then (findaeven(n,m,n+m),if n > 0 then findbeven(n,m,n+m))
33	 else findaodd(n,m,n+m))$
34input():=(n:read("enter transition curve number n"),
35      m:read("enter degree of truncation"))$
36findaeven(n,m,p):=(d:'d,det:expand(makeaeven(p)),d:n^2/4+k[2]*e^2,
37	  for i from 2 step 2 thru m do
38	      (loop(i),if i < m then d:d+k[i+2]*e^(i+2)),print("delta=",d),
39	  print(" "))$
40findbeven(n,m,p):=(d:'d,det:expand(makebeven(p)),d:n^2/4+k[2]*e^2,
41	  for i from 2 step 2 thru m do
42	      (loop(i),if i < m then d:d+k[i+2]*e^(i+2)),print("delta=",d),
43	  print(" "))$
44findaodd(n,m,p):=(d:'d,det:expand(makeaodd(p)),d:n^2/4+k[1]*e,
45	 for i thru m do (loop(i),if i < m then d:d+k[i+1]*e^(i+1)),
46	 print("delta=",d),print(" "),print("delta=",ev(d,e:-e)),print(" "))$
47loop(i):=d:ev(d,solve(taylor(ev(det),e,0,i),k[i]))$
48