Fix typo in display-html-help
[maxima.git] / share / contrib / diffequations / tests / rtestode_murphy_2_4.mac
blobf53cb41c55ee9cb093a8ff1f3ac15e119bc2fff3
1 (load("contrib_ode"),0);
2 0$
4 /* ODE tests - Murphy equations 2.301 - 2.300
6   Reference: 
7     G M Murphy, Ordinary Differential Equations and Their 
8     Solutions, Van Nostrand, 1960, pp 15-23
10     First Order and Second or Higher Degree, p278 ff
13 /* Don't kill(all); It messes up trigsimp */
15 /* Eliminate parameter t from singular solution */
16 (elim_(ans,x,y,t):=block([s],s:first(solve(ans[2],t)),s:solve(ev(ans[1],s),y),s[1]),done);
17 done;
19 /* Print ode number*/
20 (pn_(n_):=print("Murphy ODE 2.",n_),true);
21 true;
23 /* 313 */
24 (pn_(313),ans:contrib_ode(eqn:x*'diff(y,x)^3-y*'diff(y,x)^2+a=0,y,x));
25 [y=(%c^3*x+a)/%c^2,y =(3*sqrt(3)*%i-3)*a^(1/3)*x^(2/3)/(2*4^(1/3)),y=-((3*sqrt(3)*%i+3)*a^(1/3)*x^(2/3)/(2*4^(1/3))),y=3*a^(1/3)*x^(2/3)/4^(1/3)];
26 [method,ode_check(eqn,ans[1]),ode_check(eqn,ans[2]),ode_check(eqn,ans[3]),ode_check(eqn,ans[4])];
27 [clairaut,0,0,0,0];
29 /* 314 */
30 (pn_(314),ans:contrib_ode(eqn:x*'diff(y,x)^3+(2*x-y)*'diff(y,x)^2+(x-2*y)*'diff(y,x)+1-y=0,y,x));
31 [y=((%c^3+2*%c^2+%c)*x+1)/(%c^2+2*%c+1),y=3*(-sqrt(3)*%i/2-1/2)*x^(2/3)/4^(1/3)-x,y=3*(sqrt(3)*%i/2-1/2)*x^(2/3)/4^(1/3)-x,y=(9*x^(2/3)/4^(1/3)-3*x)/3];
32 [method,ode_check(eqn,ans[1]),ode_check(eqn,ans[2]),ode_check(eqn,ans[3]),ode_check(eqn,ans[4])];
33 [clairaut,0,0,0,0];
35 /* 320 */
36 (pn_(320),ans:contrib_ode(eqn:x^2*'diff(y,x)^3-2*x*y*'diff(y,x)^2+y^2*'diff(y,x)+1=0,y,x),0);
38 [method,ode_check(eqn,ans[1]),ode_check(eqn,ans[2]),ode_check(eqn,ans[3]),ode_check(eqn,ans[4])];
39 [clairaut,0,0,0,0];
41 /* 367 FIXME - check second solution */
42 (pn_(367),ans:contrib_ode(eqn:'diff(y,x)^n+x*'diff(y,x)-y=0,y,x));
43 [y=%c*x+%c^n,[-y+%t*x+%t^n=0,(%t*x+n*%t^n)/%t=0]];
44 [method,ode_check(eqn,ans[1])];
45 [clairaut,0];
47 /* 373 */
48 (pn_(373),ans:contrib_ode(eqn:2*sqrt(a*'diff(y,x))+x*'diff(y,x)-y=0,y,x));
49 [y=%c*x+2*sqrt(%c*a),[-y+%t*x+2*sqrt(a*%t)=0,(sqrt(a*%t)*x+a)/sqrt(a*%t)=0]];
50 assume(a>0,x<0);
51 [a>0,x<0];
52 first(solve(ans[2][2],%t));
53 %t=a/x^2;
54 ans[2][1],%;
55 -y-a/x=0;
56 s:first(solve(%,y));
57 y=-a/x;
58 [method,ode_check(eqn,ans[1]),ode_check(eqn,s)];
59 [clairaut,0,0];
60 forget(a>0,x<0);
61 [a>0,x<0];
63 /* 375 */
64 (pn_(375),ans:contrib_ode(eqn:2*(1+'diff(y,x))^(3/2)+3*x*'diff(y,x)-3*y=0,y,x));
65 [y=(3*%c*x+sqrt(%c+1)*(2*%c+2))/3,[-3*y+3*%t*x+2*(%t+1)^(3/2)=0,3*x+3*sqrt(%t+1)=0]];
66 assume(u>0);
67 [u>0];
68 s:subst(u^2-1,%t,ans[2]);
69 [-3*y+3*(u^2-1)*x+2*u^3=0,3*x+3*u=0];
70 solve(s[2],u);
71 [u=-x]; /* so x<0 for singular solution */
72 s[1],%[1];
73 -3*y-2*x^3+3*x*(x^2-1)=0;
74 ans[2]:first(solve(%,y));
75 y=(x^3-3*x)/3;
76 [method,ode_check(eqn,ans[1]),(assume(x<0),ode_check(eqn,ans[2]))];
77 [clairaut,0,0];
78 forget(u>0,x<0);
79 [u>0,x<0];
81 /* 381 FIXME - check second solution */
82 (pn_(381),ans:contrib_ode(eqn:sqrt(a^2+b^2*'diff(y,x)^2)+x*'diff(y,x)-y=0,y,x));
83 [y=%c*x+sqrt(%c^2*b^2+a^2),[-y+%t*x+sqrt(b^2*%t^2+a^2)=0,(sqrt(b^2*%t^2+a^2)*x+b^2*%t)/sqrt(b^2*%t^2+a^2)=0]];
84 [method,ode_check(eqn,ans[1])];
85 [clairaut,0];
87 /* 382 FIXME - check second solution */
88 (pn_(382),ans:contrib_ode(eqn:sqrt(a+2*b*'diff(y,x)+c*'diff(y,x)^2)+(x*'diff(y,x)-y)*sqrt(a*c-b^2)=0,y,x));
89 [y=(%c*sqrt(a*c-b^2)*x+sqrt(%c^2*c+2*%c*b+a))/sqrt(a*c-b^2),
90   [sqrt(a*c-b^2)*(%t*x-y)+sqrt(%t^2*c+2*%t*b+a)=0,
91    (sqrt(a*c-b^2)*sqrt(c*%t^2+2*b*%t+a)*x+c*%t+b)/sqrt(c*%t^2+2*b*%t+a)=0]];
92 [method,ode_check(eqn,ans[1])];
93 [clairaut,0];
95 /* 388 FIXME - check second solution */
96 (pn_(388),ans:contrib_ode(eqn:a*(1+'diff(y,x))^(1/3)+x*'diff(y,x)-y=0,y,x));
97 [y=%c*x+(%c+1)^(1/3)*a,[-y+%t*x+a*(%t+1)^(1/3)=0,(3*(%t+1)^(2/3)*x+a)/(3*(%t+1)^(2/3))=0]];
98 [method,ode_check(eqn,ans[1])];
99 [clairaut,0];
101 /* 389 FIXME - check second solution */
102 (pn_(389),ans:contrib_ode(eqn:(y-x*'diff(y,x))*sqrt(1+'diff(y,x)^2)+a*'diff(y,x)=0,y,x));
103 [y=(%c*sqrt(%c^2+1)*x-%c*a)/sqrt(%c^2+1),[sqrt(%t^2+1)*(y-%t*x)+%t*a=0,(%t*y-2*%t^2*x-x+sqrt(%t^2+1)*a)/sqrt(%t^2+1) = 0]];
104 [method,ode_check(eqn,ans[1])];
105 [clairaut,0];
107 /* 390 */
108 (pn_(390),ans:contrib_ode(eqn:y=x*'diff(y,x)+cos('diff(y,x)),y,x));
109 [y=cos(%c)+%c*x, [y-%t*x-cos(%t)=0,sin(%t)-x=0]];
110 first(solve(ans[2][2],%t));
111 %t=asin(x);
112 s:first(solve(ev(ans[2][1],%),y));
113 y=x*asin(x)+sqrt(1-x^2);
114 [method,ode_check(eqn,ans[1]),ode_check(eqn,s)];
115 [clairaut,0,0];
117 /* 396  FIXME - check second solution */
118 (pn_(396),ans:contrib_ode(eqn:(1+'diff(y,x)^2)*sin(y-x*'diff(y,x))^2=1,y,x));
119 [y=%c*x+asin(1/sqrt(%c^2+1)),[(%t^2+1)*sin(y-%t*x)^2-1=0,2*%t*sin(y-%t*x)^2-(2*%t^2*x+2*x)*cos(y-%t*x)*sin(y-%t*x)=0]];
120 [method,ode_check(eqn,ans[1])];
121 [clairaut,0];
123 /* 397 FIXME - check second solution */
124 (pn_(397),ans:contrib_ode(eqn:'diff(y,x)*(acos('diff(y,x))-x)+sqrt(1-'diff(y,x)^2)+y=0,y,x));
125 [y=%c*x-%c*acos(%c)-sqrt(1-%c^2),
126   [y+%t*(acos(%t)-x)+sqrt(1-%t^2)=0,
127   (sqrt(1-%t^2)*(acos(%t)-x)-2*%t)/sqrt(1-%t^2)=0]];
128 [method,ode_check(eqn,ans[1])];
129 [clairaut,0];