Remove use of special vars nn* and dn* in mtoinf.
[maxima.git] / tests / rtest5.mac
blob3974b86a37b039c4e3539bea2c7baffd105ef4ec
1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*-  ******************/
2 /***************************************************************************
3 ***                                                                    *****
4 ***     Copyright (c) 1984 by William Schelter,University of Texas     *****
5 ***     All rights reserved                                            *****
6 ***************************************************************************/
9 kill(all);
10 done$
11 partition(2*a*x*f(x),x);
12 [2*a,x*f(x)]$
13 partition(a+b,x);
14 [b+a,0]$
15 2*(a*log(x)+2*a*log(y));
16 2*(2*a*log(y)+a*log(x))$
17 logcontract(%);
18 a*log(x^2*y^4)$
19 ratsimp(logcontract(log(sqrt(x+1)+sqrt(x))+log(sqrt(x+1)-sqrt(x))));
22 /* Two examples from Bug report ID: 947808 - logcontract and ratfac */
23 logexpand:false; /* To prevent simplification of the expected result */
24 false;
25 logcontract(2*log(x+1)+1);
26 log((x+1)^2)+1;
27 logexpand:true;
28 true;
29 logcontract(1000*log(x+1)+log(x));
30 log(x*(x+1)^1000)$
32 rootsconmode:false;
33 false$
35 rootscontract(x^(1/2)*y^(3/2));
36 sqrt(x*y^3)$
38 rootscontract(x^(1/2)*y^(1/4));
39 sqrt(x)*y^(1/4)$
41 rootsconmode:true;
42 true$
44 expand(rootscontract(x^(1/2)*y^(1/4)) - sqrt(x*sqrt(y)),0,0);
47 expand(rootscontract(x^(1/2)*y^(1/3)) - sqrt(x)*y^(1/3),0,0);
50 rootsconmode:all;
51 all$
52 expand(rootscontract(x^(1/2)*y^(1/4)) - (x^2*y)^(1/4),0,0);
55 expand(rootscontract(x^(1/2)*y^(1/3)) -(x^3*y^2)^(1/6),0,0);
58 rootsconmode:false;
59 false$
60 rootscontract(sqrt(sqrt(x+1)+sqrt(x))*sqrt(sqrt(x+1)-sqrt(x)));
62 rootsconmode:true;
63 true$
65 rootscontract(sqrt(sqrt(5)+5)-5^(1/4)*sqrt(sqrt(5)+1));
68 kill(f,g,h,x,y);
69 done$
70 diff(sin(x)+x^3+2*x^2,x);
71 cos(x)+3*x^2+4*x$
72 diff(sin(x)*cos(x),x);
73 cos(x)^2-sin(x)^2$
74 diff(sin(x)*cos(x),x,2);
75 -4*cos(x)*sin(x)$
76 derivabbrev:true;
77 true$
78 diff(exp(f(x)),x,2);
79 %e^f(x)*'diff(f(x),x,2)+%e^f(x)*('diff(f(x),x,1))^2$
80 'integrate(f(x,y),y,g(x),h(x));
81 'integrate(f(x,y),y,g(x),h(x))$
82 diff(%,x);
83 'integrate('diff(f(x,y),x,1),y,g(x),h(x))
84  +f(x,h(x))*'diff(h(x),x,1)-f(x,g(x))*'diff(g(x),x,1)$
85 kill(a,x,f,y,t);
86 done$
88 /* -----------------------------------------------------------------------------
89  * Examples for dependencies
90  * -------------------------------------------------------------------------- */
91 depends(a,x);
92 [a(x)]$
93 diff(a . a,x);
94 'diff(a,x,1) . a+a . 'diff(a,x,1)$
95 depends(f,[x,y],[x,y],t);
96 [f(x,y),x(t),y(t)]$
97 diff(f,t);
98 'diff(f,y,1)*'diff(y,t,1)+'diff(f,x,1)*'diff(x,t,1)$
99 depends(y,x);
100 [y(x)]$
101 kill(f,g,j);
102 done$
104 /* More examples with subscribted variables */
106 depends(g,f,f,[x[1],x[2],x[3]],x,t);
107 [g(f),f(x[1],x[2],x[3]),x(t)]$
108 diff(g,f);
109 'diff(g,f,1)$
110 diff(f,x[1]);
111 'diff(f,x[1],1)$
112 diff(f,x[1],2);
113 'diff(f,x[1],2)$
114 diff(x[1],t);
115 'diff(x[1],t,1)$
116 diff(f,x[1],1,x[2],1,x[3],1);
117 'diff(f,x[1],1,x[2],1,x[3],1)$
118 diff(f,t);
119 'diff(x[3],t,1)*'diff(f,x[3],1)+'diff(x[2],t,1)*'diff(f,x[2],1)
120                                +'diff(x[1],t,1)*'diff(f,x[1],1)$
121 diff(g,t);
122 ('diff(x[3],t,1)*'diff(f,x[3],1)+'diff(x[2],t,1)*'diff(f,x[2],1)
123                                 +'diff(x[1],t,1)*'diff(f,x[1],1))
124  *'diff(g,f,1)$
125 kill(g,f,x);
126 done;
128 /* The subscript is not differentiated, it is a constant */
130 depends(f,x[a],x,t,t,a);
131 [f(x[a]),x(t),t(a)]$
132 diff(f,x[a]);
133 'diff(f,x[a],1)$
134 diff(f,t);
135 'diff(x[a],t,1)*'diff(f,x[a],1)$
136 diff(f,a);
137 'diff(x[a],t,1)*'diff(f,x[a],1)*'diff(t,a,1)$
138 kill(f,x,t);
139 done;
141 /* Maxima has not a problem with circular defined dependencies */
143 depends(f,x,x,t,t,f);
144 [f(x),x(t),t(f)]$
145 diff(f,x);
146 'diff(f,x,1)$
147 diff(f,t);
148 'diff(f,x,1)*'diff(x,t,1)$
149 diff(t,f);
150 'diff(t,f,1)$
151 diff(t,x);
152 'diff(f,x,1)*'diff(t,f,1)$
153 kill(f,x,t);
154 done;
156 /* Bug #2356: diff(...,%pi) doesn't give an error */
158 errcatch (diff (%pi, %pi));
161 errcatch (diff (x, rat (2/3)));
164 /* -------------------------------------------------------------------------- */
166 gradef(f(x,y),x^2,g(x,y));
167 f(x,y)$
168 diff(f(x,y),x);
169 g(x,y)*'diff(y,x,1)+x^2$
170 gradef(j(n,z),'diff(j(n,z),n),j(n-1,z)-n/z*j(n,z));
171 j(n,z)$
172 ratsimp(diff(j(2,x),x,2));
173 (j(0,x)*x^2-3*j(1,x)*x+6*j(2,x))/x^2$
174 test(f):=block([u],u:integrate(f,x),ratsimp(f-diff(u,x)));
175 test(f):=block([u],u:integrate(f,x),ratsimp(f-diff(u,x)))$
176 test(sin(x));
178 test(1/(1+x));
180 test(1/(1+x^2));
182 integrate(sin(x)^3,x);
183 cos(x)^3/3-cos(x)$
184 kill(q);
185 done$
186 integrate(%e^x/(%e^x+2),x);
187 log(%e^x+2)$
188 integrate(1/(x*log(x)),x);
189 log(log(x))$
190 integrate(sin(2*x+3),x);
191 -cos(2*x+3)/2$
193 /* Correct simplification after change to risch.lisp revision 1.17 */
195 integrate(%e^x*erf(x),x);
196 %e^x*erf(x)-%e^(1/4)*erf(x-1/2)$
198 integrate(x/(x^3+1),x);
199 log(x^2-x+1)/6+atan((2*x-1)/sqrt(3))/sqrt(3)-log(x+1)/3$
200 diff(%,x);
201 2/(3*((2*x-1)^2/3+1))+(2*x-1)/(6*(x^2-x+1))-1/(3*(x+1))$
202 ratsimp(%);
203 x/(x^3+1)$
205 /* verify that file_search finds a file specified by a path relative to top-level directory
206  * bug reported to mailing list 2015-11-08: "testsuite failure with ecl"
207  */
209 is  (file_search ("tests/test_readbase_lisp.lisp") = false);
210 false;
212 is (file_search ("tests/rtest1.mac") = false);
213 false;
215 /* verify that loading share packages via defsystem and retrieving documentation
216  * (both make use of *LOAD-PATHNAME*) do not cause errors
217  */
219 describe ("sin");
220 true;
222 (load ("load-graphs"), 0);
225 /* MYTOPIC.info is the output of makeinfo template-standalone.texi in share/ */
226 (load ("MYTOPIC-index"), 0);
229 /* frotz is described in MYTOPIC.info */
230 describe ("frotz");
231 true;