Fix typo in display-html-help
[maxima.git] / share / contrib / diffequations / tests / rtestode_murphy_1_4.mac
blobca2757702df5a9024d9dc58260d99bbc89597f32
1 (load("contrib_ode"),0);
2 0$
4 /* ODE tests - Murphy equations 1.301 - 1.400
6   Reference: 
7     G M Murphy, Ordinary Differential Equations and Their 
8     Solutions, Van Nostrand, 1960
10   First Order and of First Degree, p 224 ff
13 /* Don't kill(all); It messes up trigsimp */
15 /* Print ode number*/
16 (pn_(n_):=print("Murphy ODE 1.",n_),true);
17 true;
19 /* 301 Riccati */
21 /* 304 - Abel eqn of 1st kind */
22 (pn_(304),ans:contrib_ode(eqn:(1+x^2)*'diff(y,x)=1+y^2-2*x*y*(1+y^2),y,x)); 
23 false;
25 /* 311 */
26 (pn_(311),ans:contrib_ode(eqn:(a^2+x^2)*'diff(y,x)=a^2+3*x*y-2*y^2,y,x));
27  [y = (2*x^3*sqrt(x^2+a^2)+%c*x^4+x^2*(%c*(x^2+a^2)+%c*a^2)
28                                 +%c*a^2*(x^2+a^2)+2*a^2*x*sqrt(x^2+a^2))
29           /(2*%c*x*(x^2+a^2)+2*x^2*sqrt(x^2+a^2)+2*a^2*sqrt(x^2+a^2))];
30 [method,ode_check(eqn,ans[1])];
31 [riccati,0];
33 /* 324 Riccati */
35 /* 329 Riccati */
37 /* 333 Riccati 
38       Solution should simplify to y=x*(%c*x+sin(x))/(%c*x-sin(x)) ?
40 /*  FIXME:  This test now prompts - 2006-10-02
41 (pn_(333),ans:contrib_ode(eqn:2*x^2*'diff(y,x)=2*x*y+(1-x*cot(x))*(x^2-y^2),y,x));
42 [y=sqrt(4*x^3*cot(x)-4*x^2)*sqrt(-x^3*cot(x)^3+3*x^2*cot(x)^2-3*x*cot(x)+1)*(%c*sin('integrate(sqrt(-x^3*cot(x)^3+3*x^2*cot(x)^2-3*x*cot(x)+1)/sqrt(4*x^3*cot(x)-4*x^2),x))-cos('integrate(sqrt(-x^3*cot(x)^3+3*x^2*cot(x)^2-3*x*cot(x)+1)/sqrt(4*x^3*cot(x)-4*x^2),x)))/((2*x^2*cot(x)^2-4*x*cot(x)+2)*sin('integrate(sqrt(-x^3*cot(x)^3+3*x^2*cot(x)^2-3*x*cot(x)+1)/sqrt(4*x^3*cot(x)-4*x^2),x))+(2*%c*x^2*cot(x)^2-4*%c*x*cot(x)+2*%c)*cos('integrate(sqrt(-x^3*cot(x)^3+3*x^2*cot(x)^2-3*x*cot(x)+1)/sqrt(4*x^3*cot(x)-4*x^2),x)))];
43 [method,ode_check(eqn,ans[1])];
44 [riccati,0];
47 /* 336 Riccati */
48 (pn_(336),ans:contrib_ode(eqn:x*(1-2*x)*'diff(y,x)=4*x-(1+4*x)*y+y^2,y,x));
49 [-((x*y-2*x^2)/(y-1)) = %c];
50 ans:first(solve(ans[1],y));
51 y=(2*x^2+%c)/(x+%c);
52 [exact,ode_check(eqn,ans)];
53 [exact,0];
55 /* 337  - check this*/
56 (pn_(337),ans:contrib_ode(eqn:2*x*(1-x)*'diff(y,x)+x+(1-2*x)*y=0,y,x));
57 [y = %e^-(log(2*x^2-2*x)/2)*(log(2*sqrt(2*x^2-2*x)/sqrt(2)+2*x-1)
58          /(2*sqrt(2))+sqrt(2*x^2-2*x)/2+%c)];
59 [method,radcan(ode_check(eqn,ans[1]))];
60 [linear,0];
62 /* 338 - Runs "forever" with odelin 2006-12-10 */
63 /* (pn_(338),ans:contrib_ode(eqn:2*x*(1-x)*'diff(y,x)+x+(1-2*x)*y^2=0,y,x));
64 [[y='diff(%u,x,1)*(2*x^2-2*x)/(%u*(2*x-1)),-'diff(%u,x,1)*((2*x-1)*(4*x-2)/(2*x^2-2*x)^2-2/(2*x^2-2*x))-'diff(%u,x,2)*(2*x-1)/(2*x^2-2*x)+%u*(2*x-1)^2/((2*x-2)*(2*x^2-2*x)^2)=0]];
65 method;
66 riccati; */
68 /* 345 - Abel eqn of 1st kind */
69 (pn_(345),ans:contrib_ode(eqn:(a+b*x)^2*'diff(y,x)+c*y^2+(a+b*x)*y^3=0,y,x));
70 false;
72 /* 347 */
73 (pn_(347),ans:contrib_ode(eqn:x^3*'diff(y,x)=3-x^2+x^2*y,y,x));
74 [y=x*((x^2-1)/x^3+%c)];
75 [method,ode_check(eqn,ans[1])];
76 [linear,0];
78 /* 348 Riccati */
79 (pn_(348),ans:contrib_ode(eqn:x^3*'diff(y,x)=x^4+y^2,y,x));
80 [x=%c*%e^-(x^2/(y-x^2))]; 
81 ans:first(solve(ans[1],y));
82 y=(log(%c/x)+1)*x^2/log(%c/x);
83 [method,ode_check(eqn,ans)];
84 [genhom,0];
86 /* 352 Riccati */
87 (pn_(352),ans:contrib_ode(eqn:x^3*'diff(y,x)+20+x^2*y*(1-x^2*y)=0,y,x));
88 [x=%c*%e^-((log(x^2*y+5)-log(x^2*y-4))/9)];
89 ans:first(solve((ans[1]/%c)^9,y));
90 y=-((5*x^9+4*%c^9)/(x^11-%c^9*x^2));
91 [method,ode_check(eqn,ans)];
92 [genhom,0];
94 /* 353 Riccati */
95 (pn_(353),ans:contrib_ode(eqn:x^3*'diff(y,x)+3+(3-2*x)*x^2*y-x^6*y^2=0,y,x));
96 [y=-((3*%e^(4*x)-%c)/(x^3*%e^(4*x)+%c*x^3))];
97 [method,ode_check(eqn,ans[1])];
98 [riccati,0];
100 /* 366 Riccati */
102 /* 371 Riccati */
104 /* 373 */
105 assume(a>0);
106 [a>0];
107 ans:contrib_ode(eqn:x^4*'diff(y,x)+a^2+x^4*y^2=0,y,x);
108 [y=(x*tan((%c*x-a)/x)+a)/(x^2*tan((%c*x-a)/x))];
109 [method,ode_check(eqn,ans[1])];
110 [riccati,0];
111 forget(a>0);
112 [a>0];
114 /* 377 */
115 (pn_(377),ans:contrib_ode(eqn:x*(1-x^3)*'diff(y,x)=x^2+(1-2*x*y)*y,y,x));
116 [y = (2*%c*(x-1)*x^6+x*(3*%c*(x-1)*(x^2+x+1)-2*(x-1))
117                            +x^4*(2*(x-1)-3*%c*(x-1)*(x^2+x+1))
118                            +x^5*(%c*(x^2+x+1)+%c*(x-1))
119                            +x^2*(-%c*(x^2+x+1)-%c*(x-1))
120                            +x^3*(x^2+x+(1-2*%c)*(x-1)+1)-x^2-2*x)
121           /(3*%c*(x-1)*x^2*(x^2+x+1)+3*(x-1)*(x^2+x+1))];
122 [method,ode_check(eqn,ans[1])];
123 [riccati,0];
125 /* 380 Riccati */
127 /* 383 Abel eqn of 1st kind */
128 (pn_(383),ans:contrib_ode(eqn:x^7*'diff(y,x)+5*x^3*y^2+2*(1+x^2)*y^3=0,y,x));
129 false;
131 /* 385 Riccati */
132 (pn_(385),ans:contrib_ode(eqn:x^n*'diff(y,x)=x^(2*n-1)-y^2,y,x));
133 [y = -(((%c*'bessel_y(n,2*sqrt(-x))+'bessel_j(n,2*sqrt(-x))
134                                   -%c*'bessel_y(n-2,2*sqrt(-x))
135                                   -'bessel_j(n-2,2*sqrt(-x)))
136    *sqrt(-x)
137    +n*(%c*'bessel_y(n-1,2*sqrt(-x))+'bessel_j(n-1,2*sqrt(-x)))
138    -%c*'bessel_y(n-1,2*sqrt(-x))-'bessel_j(n-1,2*sqrt(-x)))
139    *x^(n-1)
140    /(2*%c*'bessel_y(n-1,2*sqrt(-x))+2*'bessel_j(n-1,2*sqrt(-x))))];
141 [method,ode_check(eqn,ans[1])];
142 [riccati,0];
144 /* 387 Riccati */
145 (pn_(387),ans:contrib_ode(eqn:x^n*'diff(y,x)+x^(2*n-2)+y^2+(1-n)*x^(n-1)*y=0,y,x));
146 [x=%c*%e^-atan(x^(1-n)*y)];
147 ans:map(log,ans[1]/%c);
148 log(x/%c)=-atan(x^(1-n)*y);
149 ans:map(tan,ans);
150 tan(log(x/%c))=-x^(1-n)*y;
151 ans:first(solve(ans,y));
152 y=-x^(n-1)*tan(log(x/%c));
153 [method,ode_check(eqn,%)];
154 [genhom,0];
156 /* 388 Riccati */