zimmer.rlg 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. REDUCE Development Version, Wed Sep 13 20:40:41 2000 ...
  2. ODESolve 1.065
  3. % -*- REDUCE -*-
  4. % The Postel/Zimmermann (11/4/96) ODE test examples.
  5. % Equation names from Postel/Zimmermann.
  6. % This version uses REDUCE-style variable notation wherever possible.
  7. on trode;
  8. on div, intstr;
  9. off allfac;
  10. % to look prettier
  11. % 1 Single equations without initial conditions
  12. % ==============================================
  13. % 1.1 Linear equations
  14. % ====================
  15. depend y, x;
  16. % (1) Linear Bernoulli 1
  17. odesolve((x^4-x^3)*df(y,x) + 2*x^4*y = x^3/3 + C, y, x);
  18. This is a linear ODE of order 1.
  19. It is solved by the integrating factor method.
  20. - 2*x 1 -2 1 1
  21. e *arbconst(1) + ---*c*x + ---*x - ---
  22. 2 6 4
  23. {y=-----------------------------------------------}
  24. 2
  25. x - 2*x + 1
  26. % (2) Linear Bernoulli 2
  27. odesolve(-1/2*df(y,x) + y = sin x, y, x);
  28. This is a linear ODE of order 1.
  29. It is solved by the integrating factor method.
  30. 2*x 2 4
  31. {y=e *arbconst(2) + ---*cos(x) + ---*sin(x)}
  32. 5 5
  33. % (3) Linear change of variables (FJW: shifted Euler equation)
  34. odesolve(df(y,x,2)*(a*x+b)^2 + 4df(y,x)*(a*x+b)*a + 2y*a^2 = 0, y, x);
  35. This is a linear ODE of order 2.
  36. It has non-constant coefficients.
  37. It is of the homogeneous (Euler) type (with shifted coefficients)
  38. and is reducible to a simpler ODE ...
  39. It has constant coefficients.
  40. 2 2
  41. arbconst(4)*a *x + arbconst(4)*a*b + arbconst(3)*a
  42. {y=-----------------------------------------------------}
  43. 2 2 2
  44. a *x + 2*a*b*x + b
  45. % (4) Adjoint
  46. odesolve((x^2-x)*df(y,x,2) + (2x^2+4x-3)*df(y,x) + 8x*y = 1, y, x);
  47. This is a linear ODE of order 2.
  48. It has non-constant coefficients.
  49. But ODESolve cannot solve it using linear techniques, so ...
  50. Interchanging dependent and independent variables ...
  51. 2 3 3 2 2
  52. - df(x,y,2)*x + df(x,y,2)*x + 8*df(x,y) *x*y - df(x,y) + 2*df(x,y) *x
  53. 2 2
  54. + 4*df(x,y) *x - 3*df(x,y)
  55. This is a nonlinear ODE of order 2.
  56. Interchanging dependent and independent variables ...
  57. 2 2
  58. df(y,x,2)*x - df(y,x,2)*x + 2*df(y,x)*x + 4*df(y,x)*x - 3*df(y,x) + 8*x*y - 1
  59. ODE simplifier loop interrupted!
  60. ODESolve cannot solve this ODE!
  61. 2 2
  62. {df(y,x,2)*x - df(y,x,2)*x + 2*df(y,x)*x + 4*df(y,x)*x - 3*df(y,x) + 8*x*y - 1
  63. =0}
  64. % (5) Polynomial solutions
  65. % (FJW: currently very slow, and fails anyway!)
  66. % odesolve((x^2-x)*df(y,x,2) + (1-2x^2)*df(y,x) + (4x-2)*y = 0, y, x);
  67. % (6) Dependent variable missing
  68. odesolve(df(y,x,2) + 2x*df(y,x) = 2x, y, x);
  69. This is a linear ODE of order 2.
  70. It has non-constant coefficients.
  71. Performing trivial order reduction to give the order 1
  72. linear ODE with coefficients (low -- high): {2*x,1}
  73. It is solved by the integrating factor method.
  74. 1
  75. Solution of order-reduced ODE is {{-----},1}
  76. 2
  77. x
  78. e
  79. 1
  80. Restoring order, y => df(y,x,1), to give: df(y,x)={{-----},1} and re-solving ...
  81. 2
  82. x
  83. e
  84. 1
  85. {y=arbconst(6) + ---*sqrt(pi)*arbconst(5)*erf(x) + x}
  86. 2
  87. % (7) Liouvillian solutions
  88. % (FJW: INTEGRATION IMPOSSIBLY SLOW WITHOUT EITHER ALGINT OR NOINT OPTION)
  89. begin scalar !*allfac; !*allfac := t; return
  90. odesolve((x^3/2-x^2)*df(y,x,2) + (2x^2-3x+1)*df(y,x) + (x-1)*y = 0,
  91. y, x, algint);
  92. end;
  93. This is a linear ODE of order 2.
  94. It has non-constant coefficients.
  95. It is exact, and the following linear ODE of order 1 is a first integral:
  96. 3 2 2
  97. df(y,x)*x - 2*df(y,x)*x + x *y - 2*x*y + 2*y=g10
  98. It is solved by the integrating factor method.
  99. -1
  100. - 1/2 - x - 1/2
  101. {y=x *e *(x - 2)
  102. 1/x
  103. e *sqrt(x - 2)
  104. *(arbconst(8) + arbconst(7)*int(--------------------------,x))}
  105. 2
  106. sqrt(x)*x - 2*sqrt(x)*x
  107. % NB: DO NOT RE-EVALUATE RESULT WITHOUT TURNING ON ALGINT OR NOINT SWITCH
  108. % (8) Reduction of order
  109. % (FJW: Attempting to make explicit currently too slow.)
  110. odesolve(df(y,x,2) - 2x*df(y,x) + 2y = 3, y, x);
  111. This is a linear ODE of order 2.
  112. It has non-constant coefficients.
  113. But ODESolve cannot solve it using linear techniques, so ...
  114. Interchanging dependent and independent variables ...
  115. 3 3 2
  116. - df(x,y,2) + 2*df(x,y) *y - 3*df(x,y) - 2*df(x,y) *x
  117. This is a nonlinear ODE of order 2.
  118. - 3
  119. This ODE can be simplified by the independent variable shift y => y - ------
  120. 2
  121. 3 2
  122. to give: - df(x,y,2) + 2*df(x,y) *y - 2*df(x,y) *x=0
  123. G22
  124. This ODE is equidimensional in the independent variable y -- applying y => e
  125. to transform to the simpler ODE:
  126. 3 2
  127. - df(x,G22,2) + 2*df(x,G22) - 2*df(x,G22) *x + df(x,G22)=0
  128. This ODE is autonomous -- transforming dependent variable
  129. to derivative to give this ODE of order 1 lower:
  130. 3 2
  131. - df(G23,x)*G23 + 2*G23 - 2*G23 *x + G23=0
  132. This is a nonlinear ODE that factorizes algebraically
  133. and each distinct factor ODE will be solved separately ...
  134. 2
  135. - df(G23,x) + 2*G23 - 2*G23*x + 1=0
  136. This is a nonlinear ODE of order 1.
  137. It is of Riccati type and transforms into the linear second-order ODE:
  138. df(G23,x,2) + 2*df(G23,x)*x + 2*G23=0
  139. It has non-constant coefficients.
  140. It is exact, and the following linear ODE of order 1 is a first integral:
  141. df(G23,x) + 2*G23*x=g26
  142. It is solved by the integrating factor method.
  143. Restoring order to give these first-order ODEs ...
  144. sqrt(pi)*arbconst(9)*df(x,G22)*erf(i*x)*i - sqrt(pi)*arbconst(9)*erf(i*x)*i*x
  145. 2
  146. x
  147. - e *arbconst(9) - 2*df(x,G22) + 2*x=0
  148. This is a nonlinear ODE of order 1.
  149. It is separable.
  150. df(x,G22)=0
  151. This is a linear ODE of order 1.
  152. It is solved by quadrature.
  153. {arbconst(10) + sqrt(pi)*arbconst(9)
  154. erf(i*x)
  155. *int(-----------------------------------------------------------,x)*i
  156. 2
  157. x
  158. sqrt(pi)*arbconst(9)*erf(i*x)*i*x + e *arbconst(9) - 2*x
  159. 1
  160. - 2*int(-----------------------------------------------------------,x)
  161. 2
  162. x
  163. sqrt(pi)*arbconst(9)*erf(i*x)*i*x + e *arbconst(9) - 2*x
  164. 2*y - 3
  165. - log(---------)=0}
  166. 2
  167. % (9) Integrating factors
  168. % (FJW: Currently very slow, and fails anyway!)
  169. % odesolve(sqrt(x)*df(y,x,2) + 2x*df(y,x) + 3y = 0, y, x);
  170. % (10) Radical solution (FJW: omitted for now)
  171. % (11) Undetermined coefficients
  172. odesolve(df(y,x,2) - 2/x^2*y = 7x^4 + 3*x^3, y, x);
  173. This is a linear ODE of order 2.
  174. It has non-constant coefficients.
  175. It is of the homogeneous (Euler) type and is reducible to a simpler ODE ...
  176. It has constant coefficients.
  177. Constructing particular integral using `D-operator method'.
  178. 2 -1 1 6 1 5
  179. {y=arbconst(13)*x + arbconst(12)*x + ---*x + ---*x }
  180. 4 6
  181. % (12) Variation of parameters
  182. odesolve(df(y,x,2) + y = csc(x), y, x);
  183. This is a linear ODE of order 2.
  184. It has constant coefficients.
  185. Constructing particular integral using `D-operator method'.
  186. But cannot evaluate the integrals, so ...
  187. Constructing particular integral using `variation of parameters'.
  188. The Wronskian is 1
  189. {y=arbconst(15)*sin(x) + arbconst(14)*cos(x) - cos(x)*x + log(sin(x))*sin(x)}
  190. % (13) Linear constant coefficients
  191. << factor exp(x); write
  192. odesolve(df(y,x,7) - 14df(y,x,6) + 80df(y,x,5) - 242df(y,x,4)
  193. + 419df(y,x,3) - 416df(y,x,2) + 220df(y,x) - 48y = 0, y, x);
  194. remfac exp(x) >>;
  195. This is a linear ODE of order 7.
  196. It has constant coefficients.
  197. 4*x 3*x 2*x
  198. {y=e *arbconst(17) + e *arbconst(16) + e *(arbconst(19) + arbconst(18)*x)
  199. x 2
  200. + e *(arbconst(22) + arbconst(21)*x + arbconst(20)*x )}
  201. % (14) Euler
  202. odesolve(df(y,x,4) - 4/x^2*df(y,x,2) + 8/x^3*df(y,x) - 8/x^4*y = 0, y, x);
  203. This is a linear ODE of order 4.
  204. It has non-constant coefficients.
  205. It is of the homogeneous (Euler) type and is reducible to a simpler ODE ...
  206. It has constant coefficients.
  207. 4 2 -1
  208. {y=arbconst(26)*x + arbconst(25)*x + arbconst(24)*x + arbconst(23)*x }
  209. % (15) Exact n-th order
  210. odesolve((1+x+x^2)*df(y,x,3) + (3+6x)*df(y,x,2) + 6df(y,x) = 6x, y, x);
  211. This is a linear ODE of order 3.
  212. It has non-constant coefficients.
  213. Performing trivial order reduction to give the order 2
  214. 2
  215. linear ODE with coefficients (low -- high): {6,6*x + 3,x + x + 1}
  216. But ODESolve cannot solve the reduced ODE!
  217. It is exact, and the following linear ODE of order 2 is a first integral:
  218. 2
  219. df(y,x,2)*x + df(y,x,2)*x + df(y,x,2) + 4*df(y,x)*x + 2*df(y,x) + 2*y
  220. 2
  221. =g34 + 3*x
  222. It is exact, and the following linear ODE of order 1 is a first integral:
  223. 2 3
  224. df(y,x)*x + df(y,x)*x + df(y,x) + 2*x*y + y=g34*x + g35 + x
  225. It is solved by the integrating factor method.
  226. 1 2 1 4
  227. arbconst(29) + arbconst(28)*x + ---*arbconst(27)*x + ---*x
  228. 2 4
  229. {y=--------------------------------------------------------------}
  230. 2
  231. x + x + 1
  232. % 1.2 Nonlinear equations
  233. % =======================
  234. % (16) Integrating factors 1
  235. odesolve(df(y,x) = y/(y*log y + x), y, x);
  236. This is a nonlinear ODE of order 1.
  237. Interchanging dependent and independent variables ...
  238. - df(x,y)*y + log(y)*y + x
  239. This is a linear ODE of order 1.
  240. It is solved by the integrating factor method.
  241. 1 2
  242. {x=arbconst(30)*y + ---*log(y) *y}
  243. 2
  244. % (17) Integrating factors 2
  245. odesolve(2y*df(y,x)^2 - 2x*df(y,x) - y = 0, y, x);
  246. This is a nonlinear ODE of order 1.
  247. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  248. 5 3 2
  249. 4*df(x,G39)*G39 - 8*df(x,G39)*G39 + 3*df(x,G39)*G39 + 4*G39 *x + 2*x=0
  250. This is a first-order linear ODE solved by the integrating factor method.
  251. 1/3 2 1/3
  252. 2*2 *arbconst(31)*G39 - 2 *arbconst(31)
  253. The subsidiary solution is {x=----------------------------------------------}
  254. 2/3 4 2 1/3
  255. G39 *(4*G39 - 12*G39 + 9)
  256. and the main ODE can be solved parametrically in terms of the derivative.
  257. 4 2 - 1/3 - 2/3 1/3
  258. {{y=2*(4*arbparam(1) - 12*arbparam(1) + 9) *arbparam(1) *2
  259. *arbconst(31)*arbparam(1),
  260. 4 2 - 1/3 - 2/3 1/3
  261. x=2*(4*arbparam(1) - 12*arbparam(1) + 9) *arbparam(1) *2
  262. 2 4 2 - 1/3
  263. *arbconst(31)*arbparam(1) - (4*arbparam(1) - 12*arbparam(1) + 9)
  264. - 2/3 1/3
  265. *arbparam(1) *2 *arbconst(31),
  266. arbparam(1)}}
  267. % This parametric solution is correct, cf. Zwillinger (1989) p.168 (41.10)
  268. % (except that first edition is missing the constant C)!
  269. % (18) Bernoulli 1
  270. odesolve(df(y,x) + y = y^3*sin x, y, x, explicit);
  271. This is a nonlinear ODE of order 1.
  272. It is of Bernoulli type.
  273. {y
  274. 2*x - 1/2
  275. =(5*e *arbconst(32) + 2*cos(x) + 4*sin(x)) *sqrt(5)*plus_or_minus(tag_1)
  276. }
  277. expand_plus_or_minus ws;
  278. 2*x - 1/2
  279. {y=(5*e *arbconst(32) + 2*cos(x) + 4*sin(x)) *sqrt(5),
  280. 2*x - 1/2
  281. y= - (5*e *arbconst(32) + 2*cos(x) + 4*sin(x)) *sqrt(5)}
  282. % (19) Bernoulli 2
  283. depend {P, Q}, x;
  284. begin scalar soln, !*exp, !*allfac; % for a neat solution
  285. on allfac;
  286. soln := odesolve(df(y,x) + P*y = Q*y^n, y, x);
  287. off allfac; return soln
  288. end;
  289. This is a nonlinear ODE of order 1.
  290. It is of Bernoulli type.
  291. int(p,x)
  292. - n int(p,x)*n - int(p,x) e *q
  293. {y *y= - e *((n - 1)*int(-------------,x) - arbconst(33))
  294. int(p,x)*n
  295. e
  296. }
  297. odesolve(df(y,x) + P*y = Q*y^(2/3), y, x);
  298. This is a nonlinear ODE of order 1.
  299. It is of Bernoulli type.
  300. 1/3 - 1/3*int(p,x) 1 - 1/3*int(p,x) int(p,x)/3
  301. {y =e *arbconst(34) + ---*e *int(e *q,x)}
  302. 3
  303. % (20) Clairaut 1
  304. odesolve((x^2-1)*df(y,x)^2 - 2x*y*df(y,x) + y^2 - 1 = 0, y, x, explicit);
  305. This is a nonlinear ODE of order 1.
  306. It is of Clairaut type.
  307. Solution before trying to solve for dependent variable is
  308. 2 2 2 2
  309. arbconst(35) *x - arbconst(35) - 2*arbconst(35)*x*y + y - 1=0
  310. 2 2
  311. Solution before trying to solve for dependent variable is - x - y + 1=0
  312. 2
  313. {y=arbconst(35)*x + sqrt(arbconst(35) + 1),
  314. 2
  315. y=arbconst(35)*x - sqrt(arbconst(35) + 1),
  316. 2
  317. y=sqrt( - x + 1),
  318. 2
  319. y= - sqrt( - x + 1)}
  320. % (21) Clairaut 2
  321. operator f, g;
  322. odesolve(f(x*df(y,x)-y) = g(df(y,x)), y, x);
  323. This is a nonlinear ODE of order 1.
  324. It is of Clairaut type.
  325. {f(arbconst(36)*x - y) - g(arbconst(36))=0}
  326. % (22) Equations of the form y' = f(x,y)
  327. odesolve(df(y,x) = (3x^2-y^2-7)/(exp(y)+2x*y+1), y, x);
  328. This is a nonlinear ODE of order 1.
  329. It is exact and is solved by quadrature.
  330. y 3 2
  331. {arbconst(37) + e - x + x*y + 7*x + y=0}
  332. % (23) Homogeneous
  333. odesolve(df(y,x) = (2x^3*y-y^4)/(x^4-2x*y^3), y, x);
  334. This is a nonlinear ODE of order 1.
  335. It is of algebraically homogeneous type
  336. solved by a change of variables of the form `y = vx'.
  337. 3 3
  338. {arbconst(38)*x*y + x + y =0}
  339. % (24) Factoring the equation
  340. odesolve(df(y,x)*(df(y,x)+y) = x*(x+y), y, x);
  341. This is a nonlinear ODE that factorizes algebraically
  342. and each distinct factor ODE will be solved separately ...
  343. df(y,x) + x + y=0
  344. This is a linear ODE of order 1.
  345. It is solved by the integrating factor method.
  346. df(y,x) - x=0
  347. This is a linear ODE of order 1.
  348. It is solved by quadrature.
  349. - x 1 2
  350. {y=e *arbconst(39) - x + 1,y=arbconst(40) + ---*x }
  351. 2
  352. % (25) Interchange variables
  353. % (NB: Soln in Zwillinger (1989) wrong, as is last eqn in Table 68!)
  354. odesolve(df(y,x) = x/(x^2*y^2+y^5), y, x);
  355. This is a nonlinear ODE of order 1.
  356. Interchanging dependent and independent variables ...
  357. 2 2 5
  358. - df(x,y)*x + x *y + y
  359. This is a nonlinear ODE of order 1.
  360. It is of Bernoulli type.
  361. 3
  362. 2 2/3*y 3 3
  363. {x =e *arbconst(41) - y - ---}
  364. 2
  365. % (26) Lagrange 1
  366. odesolve(y = 2x*df(y,x) - a*df(y,x)^3, y, x);
  367. This is a nonlinear ODE of order 1.
  368. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  369. 2
  370. - df(x,G58)*G58 + 3*G58 *a - 2*x=0
  371. This is a first-order linear ODE solved by the integrating factor method.
  372. 4
  373. 4*arbconst(42) + 3*G58 *a
  374. The subsidiary solution is {x=---------------------------}
  375. 2
  376. 4*G58
  377. and the main ODE can be solved parametrically in terms of the derivative.
  378. -1 1 3
  379. {{y=2*arbconst(42)*arbparam(2) + ---*arbparam(2) *a,
  380. 2
  381. -2 3 2
  382. x=arbconst(42)*arbparam(2) + ---*arbparam(2) *a,
  383. 4
  384. arbparam(2)}}
  385. odesolve(y = 2x*df(y,x) - a*df(y,x)^3, y, x, implicit);
  386. This is a nonlinear ODE of order 1.
  387. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  388. 2
  389. - df(x,G59)*G59 + 3*G59 *a - 2*x=0
  390. This is a first-order linear ODE solved by the integrating factor method.
  391. 4
  392. 4*arbconst(43) + 3*G59 *a
  393. The subsidiary solution is {x=---------------------------}
  394. 2
  395. 4*G59
  396. and the main ODE can be solved parametrically in terms of the derivative.
  397. 3 2 2 2 2
  398. {64*arbconst(43) *a + 128*arbconst(43) *a*x - 144*arbconst(43)*a*x*y
  399. 4 4 3 2
  400. + 64*arbconst(43)*x + 27*a*y - 16*x *y =0}
  401. % root_of quartic is VERY slow if explicit option used!
  402. % (27) Lagrange 2
  403. odesolve(y = 2x*df(y,x) - df(y,x)^2, y, x);
  404. This is a nonlinear ODE of order 1.
  405. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  406. - df(x,G60)*G60 + 2*G60 - 2*x=0
  407. This is a first-order linear ODE solved by the integrating factor method.
  408. 3
  409. 3*arbconst(44) + 2*G60
  410. The subsidiary solution is {x=-------------------------}
  411. 2
  412. 3*G60
  413. and the main ODE can be solved parametrically in terms of the derivative.
  414. -1 1 2
  415. {{y=2*arbconst(44)*arbparam(3) + ---*arbparam(3) ,
  416. 3
  417. -2 2
  418. x=arbconst(44)*arbparam(3) + ---*arbparam(3),
  419. 3
  420. arbparam(3)}}
  421. odesolve(y = 2x*df(y,x) - df(y,x)^2, y, x, implicit);
  422. This is a nonlinear ODE of order 1.
  423. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  424. - df(x,G61)*G61 + 2*G61 - 2*x=0
  425. This is a first-order linear ODE solved by the integrating factor method.
  426. 3
  427. 3*arbconst(45) + 2*G61
  428. The subsidiary solution is {x=-------------------------}
  429. 2
  430. 3*G61
  431. and the main ODE can be solved parametrically in terms of the derivative.
  432. 2 3 2 2 3
  433. { - 9*arbconst(45) - 12*arbconst(45)*x + 18*arbconst(45)*x*y + 3*x *y - 4*y
  434. =0}
  435. % (28) Riccati 1
  436. odesolve(df(y,x) = exp(x)*y^2 - y + exp(-x), y, x);
  437. This is a nonlinear ODE of order 1.
  438. It is of Riccati type and transforms into the linear second-order ODE:
  439. df(y,x,2) + y=0
  440. It has constant coefficients.
  441. - x - x
  442. e *arbconst(46)*sin(x) - e *cos(x)
  443. {y=------------------------------------------}
  444. arbconst(46)*cos(x) + sin(x)
  445. % (29) Riccati 2
  446. factor x;
  447. odesolve(df(y,x) = y^2 - x*y + 1, y, x);
  448. This is a nonlinear ODE of order 1.
  449. It is of Riccati type and transforms into the linear second-order ODE:
  450. df(y,x,2) + df(y,x)*x + y=0
  451. It has non-constant coefficients.
  452. It is exact, and the following linear ODE of order 1 is a first integral:
  453. df(y,x) + x*y=g66
  454. It is solved by the integrating factor method.
  455. 2
  456. 1/2*x
  457. 2*e *arbconst(47)
  458. {y=x + ------------------------------------------------------}
  459. - 1/2
  460. sqrt(pi)*sqrt(2)*arbconst(47)*erf(2 *x*i)*i - 2
  461. remfac x;
  462. % (30) Separable
  463. odesolve(df(y,x) = (9x^8+1)/(y^2+1), y, x);
  464. This is a nonlinear ODE of order 1.
  465. It is separable.
  466. 9 3
  467. {3*arbconst(48) - 3*x - 3*x + y + 3*y=0}
  468. % (31) Solvable for x
  469. odesolve(y = 2x*df(y,x) + y*df(y,x)^2, y, x);
  470. This is a nonlinear ODE of order 1.
  471. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  472. 5 2
  473. df(x,G68)*G68 - df(x,G68)*G68 - 2*G68 *x - 2*x=0
  474. This is a first-order linear ODE solved by the integrating factor method.
  475. 2
  476. arbconst(49)*G68 - arbconst(49)
  477. The subsidiary solution is {x=----------------------------------}
  478. 2
  479. G68
  480. and the main ODE can be solved parametrically in terms of the derivative.
  481. -1
  482. {{y= - 2*arbconst(49)*arbparam(4) ,
  483. -2
  484. x= - arbconst(49)*arbparam(4) + arbconst(49),
  485. arbparam(4)}}
  486. odesolve(y = 2x*df(y,x) + y*df(y,x)^2, y, x, implicit);
  487. This is a nonlinear ODE of order 1.
  488. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  489. 5 2
  490. df(x,G69)*G69 - df(x,G69)*G69 - 2*G69 *x - 2*x=0
  491. This is a first-order linear ODE solved by the integrating factor method.
  492. 2
  493. arbconst(50)*G69 - arbconst(50)
  494. The subsidiary solution is {x=----------------------------------}
  495. 2
  496. G69
  497. and the main ODE can be solved parametrically in terms of the derivative.
  498. 2 2
  499. { - 4*arbconst(50) + 4*arbconst(50)*x + y =0}
  500. % (32) Solvable for y
  501. begin scalar !*allfac; !*allfac := t; return
  502. odesolve(x = y*df(y,x) - x*df(y,x)^2, y, x)
  503. end;
  504. This is a nonlinear ODE of order 1.
  505. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  506. 2
  507. - df(x,G70)*G70 - G70 *x + x=0
  508. This is a first-order linear ODE solved by the integrating factor method.
  509. arbconst(51)*G70
  510. The subsidiary solution is {x=------------------}
  511. 2
  512. G70 /2
  513. e
  514. and the main ODE can be solved parametrically in terms of the derivative.
  515. 2
  516. - 1/2*arbparam(5) 2
  517. {{y=e *arbconst(51)*(arbparam(5) + 1),
  518. 2
  519. - 1/2*arbparam(5)
  520. x=e *arbconst(51)*arbparam(5),
  521. arbparam(5)}}
  522. % (33) Autonomous 1
  523. odesolve(df(y,x,2)-df(y,x) = 2y*df(y,x), y, x, explicit);
  524. This is a nonlinear ODE of order 2.
  525. This ODE is autonomous -- transforming dependent variable
  526. to derivative to give this ODE of order 1 lower: df(G71,y)*G71 - 2*G71*y - G71=0
  527. This is a nonlinear ODE that factorizes algebraically
  528. and each distinct factor ODE will be solved separately ...
  529. df(G71,y) - 2*y - 1=0
  530. This is a linear ODE of order 1.
  531. It is solved by quadrature.
  532. Restoring order to give these first-order ODEs ...
  533. 2
  534. - arbconst(52) + df(y,x) - y - y=0
  535. This is a nonlinear ODE of order 1.
  536. It is separable.
  537. df(y,x)=0
  538. This is a linear ODE of order 1.
  539. It is solved by quadrature.
  540. Simplifying the arbconst expressions in 4*arbconst(53)*arbconst(52)
  541. - arbconst(53) - 4*arbconst(52)*x
  542. 2*y + 1
  543. + 2*sqrt(4*arbconst(52) - 1)*atan(--------------------------) + x
  544. sqrt(4*arbconst(52) - 1)
  545. by the rewrites ...
  546. sqrt(4*arbconst(52) - 1) => arbconst(52)
  547. Solution before trying to solve for dependent variable is
  548. 2 2
  549. arbconst(53)*arbconst(52) - arbconst(52) *x
  550. 2*y + 1
  551. + 2*arbconst(52)*atan(--------------)=0
  552. arbconst(52)
  553. 1 1 1
  554. {y= - ---*arbconst(52)*tan(---*arbconst(53)*arbconst(52) - ---*arbconst(52)*x)
  555. 2 2 2
  556. 1
  557. - ---,
  558. 2
  559. y=arbconst(54)}
  560. % (34) Autonomous 2 (FJW: Slow without either algint or noint option.)
  561. odesolve(df(y,x,2)/y - df(y,x)^2/y^2 - 1 + 1/y^3 = 0, y, x, algint);
  562. This is a nonlinear ODE of order 2.
  563. This ODE is autonomous -- transforming dependent variable
  564. to derivative to give this ODE of order 1 lower:
  565. 2 2 3
  566. df(G75,y)*G75*y - G75 *y - y + 1=0
  567. This is a nonlinear ODE of order 1.
  568. It is of Bernoulli type.
  569. Restoring order to give these first-order ODEs ...
  570. sqrt(y)*sqrt(3)*df(y,x)
  571. 3 3
  572. - sqrt(3*arbconst(56)*y + 6*log(y)*y + 2)*plus_or_minus(tag_4)=0
  573. This is a nonlinear ODE of order 1.
  574. It is separable.
  575. {arbconst(57)*plus_or_minus(tag_4)
  576. sqrt(y)
  577. + sqrt(3)*int(-------------------------------------------,y)
  578. 3 3
  579. sqrt(3*arbconst(56)*y + 6*log(y)*y + 2)
  580. - plus_or_minus(tag_4)*x=0}
  581. % (35) Differentiation method
  582. odesolve(2y*df(y,x,2) - df(y,x)^2 = 1/3(df(y,x) - x*df(y,x,2))^2, y, x, explicit);
  583. This is a nonlinear ODE of order 2.
  584. G84
  585. This ODE is equidimensional in the independent variable x -- applying x => e
  586. 2
  587. to transform to the simpler ODE: - df(y,G84,2) + 4*df(y,G84,2)*df(y,G84)
  588. 2
  589. + 6*df(y,G84,2)*y - 7*df(y,G84) - 6*df(y,G84)*y=0
  590. This ODE is autonomous -- transforming dependent variable
  591. to derivative to give this ODE of order 1 lower:
  592. 2 2 2 2
  593. - df(G85,y) *G85 + 4*df(G85,y)*G85 + 6*df(G85,y)*G85*y - 7*G85 - 6*G85*y=0
  594. This is a nonlinear ODE that factorizes algebraically
  595. and each distinct factor ODE will be solved separately ...
  596. 2
  597. - df(G85,y) *G85 + 4*df(G85,y)*G85 + 6*df(G85,y)*y - 7*G85 - 6*y=0
  598. This is a nonlinear ODE of order 1.
  599. It is of Lagrange type and reduces to this subsidiary ODE for x(y'):
  600. 5 4 3 2
  601. df(y,G86)*G86 - 8*df(y,G86)*G86 + 24*df(y,G86)*G86 - 26*df(y,G86)*G86
  602. 2
  603. - 17*df(y,G86)*G86 + 42*df(y,G86) + 6*G86 *y - 12*G86*y - 18*y=0
  604. This is a first-order linear ODE solved by the integrating factor method.
  605. The subsidiary solution is {y
  606. 2
  607. arbconst(58)*G86 - 4*arbconst(58)*G86 + 7*arbconst(58)
  608. =---------------------------------------------------------}
  609. 2
  610. G86 - 4*G86 + 4
  611. and the main ODE can be solved parametrically in terms of the derivative.
  612. Restoring order to give these first-order ODEs ...
  613. 2 2
  614. 16*arbconst(58) + 4*arbconst(58)*df(y,G84) - 20*arbconst(58)*y + df(y,G84)
  615. 2
  616. - 4*df(y,G84)*y + 4*y =0
  617. This is a nonlinear ODE of order 1.
  618. It can be (partially) solved algebraically for the single-order derivative
  619. and each `root ODE' will be solved separately ...
  620. 2*arbconst(58) + df(y,G84)
  621. - 2*sqrt( - arbconst(58) + y)*sqrt(arbconst(58))*sqrt(3) - 2*y=0
  622. This is a nonlinear ODE of order 1.
  623. It is separable.
  624. 2*arbconst(58) + df(y,G84)
  625. + 2*sqrt( - arbconst(58) + y)*sqrt(arbconst(58))*sqrt(3) - 2*y=0
  626. This is a nonlinear ODE of order 1.
  627. It is separable.
  628. df(y,G84)=0
  629. This is a linear ODE of order 1.
  630. It is solved by quadrature.
  631. G84
  632. Simplifying the arbconst expressions in - e *arbconst(59)
  633. - sqrt(arbconst(58))*sqrt(3) - sqrt( - arbconst(58) + y) by the rewrites ...
  634. sqrt(arbconst(58)) => arbconst(58)
  635. G84
  636. Simplifying the arbconst expressions in - e *arbconst(60)
  637. + sqrt(arbconst(58))*sqrt(3) - sqrt( - arbconst(58) + y) by the rewrites ...
  638. sqrt(arbconst(58)) => arbconst(58)
  639. Solution before trying to solve for dependent variable is
  640. 2
  641. - arbconst(59)*x - sqrt(3)*arbconst(58) - sqrt( - arbconst(58) + y)=0
  642. Solution before trying to solve for dependent variable is
  643. 2
  644. - arbconst(60)*x + sqrt(3)*arbconst(58) - sqrt( - arbconst(58) + y)=0
  645. 2 2 2
  646. {y=arbconst(59) *x + 2*sqrt(3)*arbconst(59)*arbconst(58)*x + 4*arbconst(58) ,
  647. 2 2 2
  648. y=arbconst(60) *x - 2*sqrt(3)*arbconst(60)*arbconst(58)*x + 4*arbconst(58) ,
  649. y=arbconst(61)}
  650. % (36) Equidimensional in x
  651. odesolve(x*df(y,x,2) = 2y*df(y,x), y, x, explicit);
  652. This is a nonlinear ODE of order 2.
  653. G95
  654. This ODE is equidimensional in the independent variable x -- applying x => e
  655. to transform to the simpler ODE: df(y,G95,2) - 2*df(y,G95)*y - df(y,G95)=0
  656. This ODE is autonomous -- transforming dependent variable
  657. to derivative to give this ODE of order 1 lower: df(G96,y)*G96 - 2*G96*y - G96=0
  658. This is a nonlinear ODE that factorizes algebraically
  659. and each distinct factor ODE will be solved separately ...
  660. df(G96,y) - 2*y - 1=0
  661. This is a linear ODE of order 1.
  662. It is solved by quadrature.
  663. Restoring order to give these first-order ODEs ...
  664. 2
  665. - arbconst(62) + df(y,G95) - y - y=0
  666. This is a nonlinear ODE of order 1.
  667. It is separable.
  668. df(y,G95)=0
  669. This is a linear ODE of order 1.
  670. It is solved by quadrature.
  671. Simplifying the arbconst expressions in 4*arbconst(63)*arbconst(62)
  672. - arbconst(63) - 4*arbconst(62)*G95
  673. 2*y + 1
  674. + 2*sqrt(4*arbconst(62) - 1)*atan(--------------------------) + G95
  675. sqrt(4*arbconst(62) - 1)
  676. by the rewrites ...
  677. sqrt(4*arbconst(62) - 1) => arbconst(62)
  678. Solution before trying to solve for dependent variable is
  679. 2 2
  680. arbconst(63)*arbconst(62) - arbconst(62) *log(x)
  681. 2*y + 1
  682. + 2*arbconst(62)*atan(--------------)=0
  683. arbconst(62)
  684. 1
  685. {y= - ---*arbconst(62)
  686. 2
  687. 1 1 1
  688. *tan(---*arbconst(63)*arbconst(62) - ---*arbconst(62)*log(x)) - ---,
  689. 2 2 2
  690. y=arbconst(64)}
  691. % (37) Equidimensional in y
  692. odesolve((1-x)*(y*df(y,x,2)-df(y,x)^2) + x^2*y^2 = 0, y, x);
  693. This is a nonlinear ODE of order 2.
  694. G102
  695. This ODE is equidimensional in the dependent variable y -- applying y => e
  696. 2
  697. to transform to the simpler ODE: - df(G102,x,2)*x + df(G102,x,2) + x =0
  698. This is a linear ODE of order 2.
  699. It has constant coefficients.
  700. Constructing particular integral using `D-operator method'.
  701. 3 2
  702. arbconst(66) + arbconst(65)*x + 1/6*x + 1/2*x - x x
  703. e *(x - 1)
  704. {y=---------------------------------------------------------------}
  705. x - 1
  706. % (38) Exact second order
  707. odesolve(x*y*df(y,x,2) + x*df(y,x)^2 + y*df(y,x) = 0, y, x, explicit);
  708. This is a nonlinear ODE of order 2.
  709. G106
  710. This ODE is equidimensional in the independent variable x -- applying x => e
  711. 2
  712. to transform to the simpler ODE: df(y,G106,2)*y + df(y,G106) =0
  713. This ODE is autonomous -- transforming dependent variable
  714. 2
  715. to derivative to give this ODE of order 1 lower: df(G107,y)*G107*y + G107 =0
  716. This is a nonlinear ODE that factorizes algebraically
  717. and each distinct factor ODE will be solved separately ...
  718. df(G107,y)*y + G107=0
  719. This is a linear ODE of order 1.
  720. It is solved by the integrating factor method.
  721. Restoring order to give these first-order ODEs ...
  722. - arbconst(67) + df(y,G106)*y=0
  723. This is a nonlinear ODE of order 1.
  724. It is separable.
  725. df(y,G106)=0
  726. This is a linear ODE of order 1.
  727. It is solved by quadrature.
  728. Solution before trying to solve for dependent variable is
  729. 2
  730. 2*arbconst(68)*arbconst(67) - 2*arbconst(67)*log(x) + y =0
  731. {y=sqrt( - arbconst(68) + log(x))*sqrt(arbconst(67))*sqrt(2),
  732. y= - sqrt( - arbconst(68) + log(x))*sqrt(arbconst(67))*sqrt(2),
  733. y=arbconst(69)}
  734. % (39) Factoring differential operator
  735. odesolve(df(y,x,2)^2 - 2df(y,x)*df(y,x,2) + 2y*df(y,x) - y^2 = 0, y, x);
  736. This is a nonlinear ODE that factorizes algebraically
  737. and each distinct factor ODE will be solved separately ...
  738. df(y,x,2) - 2*df(y,x) + y=0
  739. This is a linear ODE of order 2.
  740. It has constant coefficients.
  741. df(y,x,2) - y=0
  742. This is a linear ODE of order 2.
  743. It has constant coefficients.
  744. x x
  745. {y=e *arbconst(71) + e *arbconst(70)*x,
  746. x - x
  747. y=e *arbconst(73) + e *arbconst(72)}
  748. % (40) Scale invariant (fails with algint option)
  749. odesolve(x^2*df(y,x,2) + 3x*df(y,x) = 1/(y^3*x^4), y, x);
  750. This is a nonlinear ODE of order 2.
  751. -1
  752. This ODE is scale invariant -- applying y => x *G113
  753. to transform to the simpler ODE:
  754. 3 2 3 4
  755. df(G113,x,2)*G113 *x + df(G113,x)*G113 *x - G113 - 1=0
  756. G115
  757. This ODE is equidimensional in the independent variable x -- applying x => e
  758. 3 4
  759. to transform to the simpler ODE: df(G113,G115,2)*G113 - G113 - 1=0
  760. This ODE is autonomous -- transforming dependent variable
  761. to derivative to give this ODE of order 1 lower:
  762. 3 4
  763. df(G116,G113)*G113 *G116 - G113 - 1=0
  764. This is a nonlinear ODE of order 1.
  765. It is separable.
  766. Restoring order to give these first-order ODEs ...
  767. 2 2 2 4
  768. 4*arbconst(74)*G113 + df(G113,G115) *G113 - G113 + 1=0
  769. This is a nonlinear ODE of order 1.
  770. It can be (partially) solved algebraically for the single-order derivative
  771. and each `root ODE' will be solved separately ...
  772. df(G113,G115)*G113
  773. 2 4
  774. - sqrt( - 4*arbconst(74)*G113 + G113 - 1)*plus_or_minus(tag_6)=0
  775. This is a nonlinear ODE of order 1.
  776. It is separable.
  777. {2*arbconst(75)*plus_or_minus(tag_6)
  778. 2 2 4 4 2 2
  779. - 2*arbconst(74) + sqrt( - 4*arbconst(74)*x *y + x *y - 1) + x *y
  780. + log(-----------------------------------------------------------------------)
  781. 2
  782. sqrt(4*arbconst(74) + 1)
  783. - 2*log(x)*plus_or_minus(tag_6)=0}
  784. % Revised scale-invariant example (hangs with algint option):
  785. ode := x^2*df(y,x,2) + 3x*df(y,x) + 2*y = 1/(y^3*x^4);
  786. 2 -4 -3
  787. ode := df(y,x,2)*x + 3*df(y,x)*x + 2*y=x *y
  788. % Choose full (explicit and expanded) solution:
  789. odesolve(ode, y, x, full);
  790. This is a nonlinear ODE of order 2.
  791. -1
  792. This ODE is scale invariant -- applying y => x *G122
  793. to transform to the simpler ODE:
  794. 3 2 3 4
  795. df(G122,x,2)*G122 *x + df(G122,x)*G122 *x + G122 - 1=0
  796. G124
  797. This ODE is equidimensional in the independent variable x -- applying x => e
  798. 3 4
  799. to transform to the simpler ODE: df(G122,G124,2)*G122 + G122 - 1=0
  800. This ODE is autonomous -- transforming dependent variable
  801. to derivative to give this ODE of order 1 lower:
  802. 3 4
  803. df(G125,G122)*G122 *G125 + G122 - 1=0
  804. This is a nonlinear ODE of order 1.
  805. It is separable.
  806. Restoring order to give these first-order ODEs ...
  807. 2 2 2 4
  808. 15*arbconst(76)*G122 - 4*df(G122,G124) *G122 - 4*G122 - 4=0
  809. This is a nonlinear ODE of order 1.
  810. It can be (partially) solved algebraically for the single-order derivative
  811. and each `root ODE' will be solved separately ...
  812. 2*df(G122,G124)*G122
  813. 2 4
  814. - sqrt(15*arbconst(76)*G122 - 4*G122 - 4)*plus_or_minus(tag_7)=0
  815. This is a nonlinear ODE of order 1.
  816. It is separable.
  817. Solution before trying to solve for dependent variable is
  818. 2 2
  819. 15*arbconst(76) - 8*x *y
  820. 2*arbconst(77)*plus_or_minus(tag_7) - asin(------------------------------)
  821. 2
  822. sqrt(225*arbconst(76) - 64)
  823. - 2*log(x)*plus_or_minus(tag_7)=0
  824. 1
  825. {y= - ---*sqrt(15*arbconst(76)
  826. 2
  827. 2
  828. - sqrt(225*arbconst(76) - 64)*sin(2*arbconst(77) - 2*log(x)))
  829. - 1/2 -1
  830. *2 *x ,
  831. 1
  832. y= - ---*sqrt(15*arbconst(76)
  833. 2
  834. 2
  835. + sqrt(225*arbconst(76) - 64)*sin(2*arbconst(77) - 2*log(x)))
  836. - 1/2 -1
  837. *2 *x ,
  838. 1
  839. y=---*sqrt(15*arbconst(76)
  840. 2
  841. 2
  842. - sqrt(225*arbconst(76) - 64)*sin(2*arbconst(77) - 2*log(x)))
  843. - 1/2 -1
  844. *2 *x ,
  845. 1
  846. y=---*sqrt(15*arbconst(76)
  847. 2
  848. 2
  849. + sqrt(225*arbconst(76) - 64)*sin(2*arbconst(77) - 2*log(x)))
  850. - 1/2 -1
  851. *2 *x }
  852. % or "explicit, expand"
  853. % Check it -- each solution should simplify to 0:
  854. foreach soln in ws collect
  855. trigsimp sub(soln, num(lhs ode - rhs ode));
  856. {0,0,0,0}
  857. % (41) Autonomous, 3rd order
  858. odesolve((df(y,x)^2+1)*df(y,x,3) - 3df(y,x)*df(y,x,2)^2 = 0, y, x);
  859. This is a nonlinear ODE of order 3.
  860. Performing trivial order reduction to give the order 2 nonlinear ODE:
  861. 2 2
  862. df(y,x,2)*y + df(y,x,2) - 3*df(y,x) *y=0
  863. This ODE is autonomous -- transforming dependent variable
  864. to derivative to give this ODE of order 1 lower:
  865. 2 2
  866. df(G131,y)*G131*y + df(G131,y)*G131 - 3*G131 *y=0
  867. This is a nonlinear ODE that factorizes algebraically
  868. and each distinct factor ODE will be solved separately ...
  869. 2
  870. df(G131,y)*y + df(G131,y) - 3*G131*y=0
  871. This is a linear ODE of order 1.
  872. It is solved by the integrating factor method.
  873. Restoring order to give these first-order ODEs ...
  874. 2 2 2
  875. - sqrt(y + 1)*arbconst(78)*y - sqrt(y + 1)*arbconst(78) + df(y,x)=0
  876. This is a nonlinear ODE of order 1.
  877. It is separable.
  878. df(y,x)=0
  879. This is a linear ODE of order 1.
  880. It is solved by quadrature.
  881. 2
  882. Solution of order-reduced ODE is {arbconst(79)*arbconst(78)*y
  883. 2
  884. + arbconst(79)*arbconst(78) - arbconst(78)*x*y - arbconst(78)*x
  885. 2 2
  886. + sqrt(y + 1)*y + y + 1=0,
  887. y=arbconst(80)}
  888. 2
  889. Restoring order, y => df(y,x,1), to give: {arbconst(79)*arbconst(78)*df(y,x)
  890. 2
  891. + arbconst(79)*arbconst(78) - arbconst(78)*df(y,x) *x - arbconst(78)*x
  892. 2 2
  893. + df(y,x) + sqrt(df(y,x) + 1)*df(y,x) + 1=0,
  894. df(y,x)=arbconst(80)} and re-solving ...
  895. Simplifying the arbconst expressions in (arbconst(81)*arbconst(78) + sqrt(
  896. 2
  897. arbconst(79) *arbconst(78) - 2*arbconst(79)*arbconst(78)*x
  898. 2
  899. + 2*arbconst(79) + arbconst(78)*x - 2*x)*sqrt(arbconst(78))*i)/arbconst(
  900. 78) by the rewrites ...
  901. sqrt(arbconst(78)) => arbconst(78)
  902. 2 2
  903. {y=arbconst(81) + sqrt(arbconst(79) *arbconst(78)
  904. 2 2 2
  905. - 2*arbconst(79)*arbconst(78) *x + 2*arbconst(79) + arbconst(78) *x - 2*x)
  906. -1
  907. *arbconst(78) *i,
  908. y=arbconst(82) + i*x,
  909. y=arbconst(83) - i*x,
  910. y=arbconst(84) + arbconst(80)*x}
  911. % (42) Autonomous, 4th order
  912. odesolve(3*df(y,x,2)*df(y,x,4) - 5df(y,x,3)^2 = 0, y, x);
  913. This is a nonlinear ODE of order 4.
  914. Performing trivial order reduction to give the order 2 nonlinear ODE:
  915. 2
  916. 3*df(y,x,2)*y - 5*df(y,x) =0
  917. This ODE is autonomous -- transforming dependent variable
  918. 2
  919. to derivative to give this ODE of order 1 lower: 3*df(G136,y)*G136*y - 5*G136 =0
  920. This is a nonlinear ODE that factorizes algebraically
  921. and each distinct factor ODE will be solved separately ...
  922. 3*df(G136,y)*y - 5*G136=0
  923. This is a linear ODE of order 1.
  924. It is solved by the integrating factor method.
  925. Restoring order to give these first-order ODEs ...
  926. 2/3
  927. - y *arbconst(85)*y + df(y,x)=0
  928. This is a nonlinear ODE of order 1.
  929. It is separable.
  930. df(y,x)=0
  931. This is a linear ODE of order 1.
  932. It is solved by quadrature.
  933. Solution of order-reduced ODE is {
  934. 2/3 2/3
  935. 2*y *arbconst(86)*arbconst(85) - 2*y *arbconst(85)*x - 3=0,
  936. y=arbconst(87)}
  937. Restoring order, y => df(y,x,2), to give: {
  938. 2/3 2/3
  939. 2*df(y,x,2) *arbconst(86)*arbconst(85) - 2*df(y,x,2) *arbconst(85)*x - 3
  940. =0,
  941. df(y,x,2)=arbconst(87)} and re-solving ...
  942. 2
  943. Simplifying the arbconst expressions in (arbconst(89)*arbconst(85) *x
  944. 2
  945. + arbconst(88)*arbconst(85)
  946. 2
  947. - 3*sqrt(arbconst(86) - x)*sqrt(arbconst(85))*sqrt(6))/arbconst(85)
  948. by the rewrites ...
  949. sqrt(arbconst(85)) => arbconst(85)
  950. 2
  951. Simplifying the arbconst expressions in (arbconst(91)*arbconst(85) *x
  952. 2
  953. + arbconst(90)*arbconst(85)
  954. 2
  955. + 3*sqrt(arbconst(86) - x)*sqrt(arbconst(85))*sqrt(6))/arbconst(85)
  956. by the rewrites ...
  957. sqrt(arbconst(85)) => arbconst(85)
  958. {y=arbconst(89)*x + arbconst(88)
  959. -3
  960. - 3*sqrt(arbconst(86) - x)*sqrt(6)*arbconst(85) ,
  961. y=arbconst(91)*x + arbconst(90)
  962. -3
  963. + 3*sqrt(arbconst(86) - x)*sqrt(6)*arbconst(85) ,
  964. 1 2
  965. y=arbconst(93)*x + arbconst(92) + ---*arbconst(87)*x }
  966. 2
  967. % 1.3 Special equations
  968. % =====================
  969. % (43) Delay
  970. operator y;
  971. odesolve(df(y(x),x) + a*y(x-1) = 0, y(x), x);
  972. ***** Arguments of y differ -- solving delay equations is not implemented.
  973. % (44) Functions with several parameters
  974. odesolve(df(y(x,a),x) = a*y(x,a), y(x,a), x);
  975. This is a linear ODE of order 1.
  976. It is solved by the integrating factor method.
  977. a*x
  978. {y(x,a)=e *arbconst(94)}
  979. % 2 Single equations with initial conditions
  980. % ===========================================
  981. % (45) Exact 4th order
  982. odesolve(df(y,x,4) = sin x, y, x,
  983. {x=0, y=0, df(y,x)=0, df(y,x,2)=0, df(y,x,3)=0});
  984. This is a linear ODE of order 4.
  985. It has constant coefficients.
  986. Constructing particular integral using `D-operator method'.
  987. General solution is {y
  988. 2 3
  989. =arbconst(98) + arbconst(97)*x + arbconst(96)*x + arbconst(95)*x + sin(x)}
  990. Applying conditions {{x=0,y=0,df(y,x)=0,df(y,x,2)=0,df(y,x,3)=0}}
  991. 1 3
  992. {y=sin(x) + ---*x - x}
  993. 6
  994. % (46) Linear polynomial coefficients -- Bessel J0
  995. odesolve(x*df(y,x,2) + df(y,x) + 2x*y = 0, y, x,
  996. {x=0, y=1, df(y,x)=0});
  997. This is a linear ODE of order 2.
  998. It has non-constant coefficients.
  999. The reduced ODE can be solved in terms of special functions.
  1000. General solution is {y
  1001. =arbconst(100)*bessely(0,sqrt(2)*x) + arbconst(99)*besselj(0,sqrt(2)*x)}
  1002. Applying conditions {{x=0,y=1,df(y,x)=0}}
  1003. {y=besselj(0,sqrt(2)*x)}
  1004. % (47) Second-degree separable
  1005. soln :=
  1006. odesolve(x*df(y,x)^2 - y^2 + 1 = 0, y=1, x=0, explicit);
  1007. This is a nonlinear ODE of order 1.
  1008. It can be (partially) solved algebraically for the single-order derivative
  1009. and each `root ODE' will be solved separately ...
  1010. 2
  1011. sqrt(x)*df(y,x) - sqrt(y - 1)*plus_or_minus(tag_8)=0
  1012. This is a nonlinear ODE of order 1.
  1013. It is separable.
  1014. General solution is {arbconst(101)*plus_or_minus(tag_8)
  1015. 2
  1016. - 2*sqrt(x)*plus_or_minus(tag_8) + log(sqrt(y - 1) + y)=0}
  1017. Applying conditions {{x=0,y=1}}
  1018. Solution before trying to solve for dependent variable is
  1019. 2
  1020. - 2*sqrt(x)*plus_or_minus(tag_8) + log(sqrt(y - 1) + y)=0
  1021. soln :=
  1022. 1 2*sqrt(x)*plus_or_minus(tag_8) 1 - 2*sqrt(x)*plus_or_minus(tag_8)
  1023. {y=---*e + ---*e }
  1024. 2 2
  1025. % Alternatively ...
  1026. soln where e^~x => cosh x + sinh x;
  1027. {y=cosh(2*sqrt(x)*plus_or_minus(tag_8))}
  1028. % but this works ONLY with `on div, intstr; off allfac;'
  1029. % A better alternative is ...
  1030. trigsimp(soln, hyp, combine);
  1031. {y=cosh(2*sqrt(x)*plus_or_minus(tag_8))}
  1032. expand_plus_or_minus ws;
  1033. {y=cosh(2*sqrt(x))}
  1034. % (48) Autonomous
  1035. odesolve(df(y,x,2) + y*df(y,x)^3 = 0, y, x, {x=0, y=0, df(y,x)=2});
  1036. This is a nonlinear ODE of order 2.
  1037. This ODE is autonomous -- transforming dependent variable
  1038. 3
  1039. to derivative to give this ODE of order 1 lower: df(G148,y)*G148 + G148 *y=0
  1040. This is a nonlinear ODE that factorizes algebraically
  1041. and each distinct factor ODE will be solved separately ...
  1042. 2
  1043. df(G148,y) + G148 *y=0
  1044. This is a nonlinear ODE of order 1.
  1045. It is separable.
  1046. Restoring order to give these first-order ODEs ...
  1047. 2
  1048. 2*arbconst(102)*df(y,x) - df(y,x)*y + 2=0
  1049. This is a nonlinear ODE of order 1.
  1050. It is separable.
  1051. df(y,x)=0
  1052. This is a linear ODE of order 1.
  1053. It is solved by quadrature.
  1054. 3
  1055. General solution is {6*arbconst(103) - 6*arbconst(102)*y - 6*x + y =0,y
  1056. =arbconst(104)}
  1057. Applying conditions {{x=0,y=0,df(y,x)=2}}
  1058. 3
  1059. { - 6*x + y + 3*y=0}
  1060. %% Only one explicit solution satisfies the conditions:
  1061. begin scalar !*trode, !*fullroots; !*fullroots := t; return
  1062. odesolve(df(y,x,2) + y*df(y,x)^3 = 0, y, x,
  1063. {x=0, y=0, df(y,x)=2}, explicit);
  1064. end;
  1065. 2 1/3 2 - 1/3
  1066. {y=(sqrt(9*x + 1) + 3*x) - (sqrt(9*x + 1) + 3*x) }
  1067. % 3 Systems of equations
  1068. % =======================
  1069. % (49) Integrable combinations
  1070. depend {x, y, z}, t;
  1071. odesolve({df(x,t) = -3y*z, df(y,t) = 3x*z, df(z,t) = -x*y}, {x,y,z}, t);
  1072. odesolve-system({df(x,t) + 3*y*z,
  1073. df(y,t) - 3*x*z,
  1074. df(z,t) + x*y},{x,y,z},t)
  1075. % (50) Matrix Riccati
  1076. depend {a, b}, t;
  1077. odesolve({df(x,t) = a*(y^2-x^2) + 2b*x*y + 2c*x,
  1078. df(y,t) = b*(y^2-x^2) - 2a*x*y + 2c*y}, {x,y}, t);
  1079. 2 2
  1080. odesolve-system({df(x,t) + a*x - a*y - 2*b*x*y - 2*c*x,
  1081. 2 2
  1082. df(y,t) + 2*a*x*y + b*x - b*y - 2*c*y},{x,y},t)
  1083. % (51) Triangular
  1084. odesolve({df(x,t) = x*(1 + cos(t)/(2+sin(t))), df(y,t) = x - y},
  1085. {x,y}, t);
  1086. - cos(t)*x + df(x,t)*sin(t) + 2*df(x,t) - sin(t)*x - 2*x
  1087. odesolve-system({-----------------------------------------------------------,
  1088. sin(t) + 2
  1089. df(y,t) - x + y},{x,y},t)
  1090. % (52) Vector
  1091. odesolve({df(x,t) = 9x + 2y, df(y,t) = x + 8y}, {x,y}, t);
  1092. odesolve-system({df(x,t) - 9*x - 2*y,df(y,t) - x - 8*y},{x,y},t)
  1093. % (53) Higher order
  1094. odesolve({df(x,t) - x + 2y = 0, df(x,t,2) - 2df(y,t) = 2t - cos(2t)},
  1095. {x,y}, t);
  1096. odesolve-system({df(x,t) - x + 2*y,
  1097. cos(2*t) + df(x,t,2) - 2*df(y,t) - 2*t},{x,y},t)
  1098. % (54) Inhomogeneous system
  1099. equ := {df(x,t) = -1/(t*(t^2+1))*x + 1/(t^2*(t^2+1))*y + 1/t,
  1100. df(y,t) = -t^2/(t^2+1)*x + (2t^2+1)/(t*(t^2+1))*y + 1};
  1101. -1 -1 -2
  1102. t - t *x + t + t *y
  1103. equ := {df(x,t)=-------------------------,
  1104. 2
  1105. t + 1
  1106. 2 2 -1
  1107. - t *x + t + 2*t*y + t *y + 1
  1108. df(y,t)=----------------------------------}
  1109. 2
  1110. t + 1
  1111. odesolve(equ, {x,y}, t);
  1112. 2 -1 -1 -2
  1113. df(x,t)*t + df(x,t) - t + t *x - t - t *y
  1114. odesolve-system({------------------------------------------------,
  1115. 2
  1116. t + 1
  1117. 2 2 2 -1
  1118. df(y,t)*t + df(y,t) + t *x - t - 2*t*y - t *y - 1
  1119. ------------------------------------------------------},{x,y},t
  1120. 2
  1121. t + 1
  1122. )
  1123. end;
  1124. Time for test: 20727 ms, plus GC time: 1952 ms