3 ***************************************************************
6 * <functionality description> *
8 * from: "Determinacy of Degenerate Equilibria" *
9 * by Rand & Keith Applied Mathematics *
10 * and Computation 21:1-19 (1987) *
12 * Programmed by Richard Rand *
13 * These files are released to the public domain *
15 ***************************************************************
17 /* takens' blow-up calculation */
21 /* variable i tags loop */
24 if i=1 then inputrhs() ,
28 print(" takens' test "),
29 print(" truncate f and g to homogeneous polynomials "),
30 print(takens_truncate()),
33 if flag=green then return("done"),
38 /* subroutines to create variable names at ith loop */
55 /* subroutine to input the rhs's from keyboard */
57 print(" enter the rhs's to be studied "),
58 print(" use variables x,y, they will be converted to x1,y1 "),
64 /* subroutine to truncate f and g to terms of lowest degree */
65 takens_truncate():=block(
66 for j from 2 thru 8 do
67 (temp1:ratexpand([ev(f),ev(g)]),
68 temp2:taylor(temp1,[ev(x),ev(y)],0,j),
69 if temp2 # taylor([0,0],dummy,0,1) then return(temp2)))$
71 /* subroutine to solve gtrunc = 0 */
73 print("solving gtrunc = 0"),
76 gtruncx:diff(gtrunc,ev(x)),
77 gtruncy:diff(gtrunc,ev(y)),
78 xroots:solve(gtrunc,ev(x)),
79 yroots:solve(gtrunc,ev(y)),
81 for k:1 thru length(xroots) do
83 root[rootnum]:part(xroots,k)),
84 for k:1 thru length(yroots) do
86 root[rootnum]:part(yroots,k)),
87 print("total no. of roots =",rootnum))$
89 /* perform takens' test for each root */
92 for k:1 thru rootnum do (print(root[k]),
93 ftest:ev(ftrunc,root[k]),
94 gxtest:ev(gtruncx,root[k]),
95 gytest:ev(gtruncy,root[k]),
96 /* print("ftrunc =",ftest),
97 print("gxtrunc =",gxtest),
98 print("gytrunc =",gytest), */
99 if ftest=0 then (print("ftrunc is zero!"), flag:red) else
100 if gxtest=0 and gytest=0 then (print("dg trunc is zero!"),flag:red)),
101 if flag=green then "passed test" else "failed test"))$
103 /* subroutine to define f and g */
105 f::expand(ev(x*u+y*v)),
107 g::expand(ev(x*v-y*u)),
110 /* subroutine to define p and q */
112 trans:[ev(x)=r*cos(s),ev(y)=r*sin(s)],
113 p::ev(f)/r,p::expand(ev(ev(p),trans)),
115 q::ev(g)/r^2,q::expand(ev(ev(q),trans)),
118 /* subroutine to define pp and qq */
120 exponent:min(lopow(ev(p),r),lopow(ev(q),r)),
121 pp::expand(ev(p)/r^exponent),
122 qq::expand(ev(q)/r^exponent),
123 print("divide out",r^exponent),
124 /* print(pp,"=",ev(pp)),
125 print(qq,"=",ev(qq)), */
126 print("now set",r,"= 0"),
127 ptemp:ev(ev(pp),r::0),
128 qtemp:ev(ev(qq),r::0),
130 print("note: previous should be zero!"),
131 print(qq,"=",qtemp))$
133 /* subroutine to find roots s of qq=0 when r=0 */
134 /* user selects root sstar to be used */
136 stemp:solve(qtemp,ev(s)),
137 for k:1 thru length(stemp) do
138 print("root no.",k,",",part(stemp,k)),
139 print("there are",length(stemp),"roots"),
140 rootno:read("pick a root no., or 0 to enter one"),
141 if rootno=0 then sstar:read("enter root") else
142 sstar:rhs(part(stemp,rootno)),
143 print(s,"star =",sstar))$
145 /* subroutine to taylor expand pp and qq about r=0, s=star */
146 /* returns new u and v for next iteration */
151 pow:read("keep terms of what power?"),
153 u::taylor(ev(ev(pp)),[ev(x),ev(y)],0,pow),
156 v::taylor(ev(ev(qq)),[ev(x),ev(y)],0,pow),