1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
2 /***************************************************************************
4 *** Copyright (c) 1984 by William Schelter,University of Texas *****
5 *** All rights reserved *****
6 ***************************************************************************/
11 partition(2*a*x*f(x),x);
15 2*(a*log(x)+2*a*log(y));
16 2*(2*a*log(y)+a*log(x))$
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 */
25 logcontract(2*log(x+1)+1);
29 logcontract(1000*log(x+1)+log(x));
35 rootscontract(x^(1/2)*y^(3/2));
38 rootscontract(x^(1/2)*y^(1/4));
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);
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);
60 rootscontract(sqrt(sqrt(x+1)+sqrt(x))*sqrt(sqrt(x+1)-sqrt(x)));
65 rootscontract(sqrt(sqrt(5)+5)-5^(1/4)*sqrt(sqrt(5)+1));
70 diff(sin(x)+x^3+2*x^2,x);
72 diff(sin(x)*cos(x),x);
74 diff(sin(x)*cos(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))$
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)$
88 /* -----------------------------------------------------------------------------
89 * Examples for dependencies
90 * -------------------------------------------------------------------------- */
94 'diff(a,x,1) . a+a . 'diff(a,x,1)$
95 depends(f,[x,y],[x,y],t);
98 'diff(f,y,1)*'diff(y,t,1)+'diff(f,x,1)*'diff(x,t,1)$
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)]$
116 diff(f,x[1],1,x[2],1,x[3],1);
117 'diff(f,x[1],1,x[2],1,x[3],1)$
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)$
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))
128 /* The subscript is not differentiated, it is a constant */
130 depends(f,x[a],x,t,t,a);
135 'diff(x[a],t,1)*'diff(f,x[a],1)$
137 'diff(x[a],t,1)*'diff(f,x[a],1)*'diff(t,a,1)$
141 /* Maxima has not a problem with circular defined dependencies */
143 depends(f,x,x,t,t,f);
148 'diff(f,x,1)*'diff(x,t,1)$
152 'diff(f,x,1)*'diff(t,f,1)$
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));
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));
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)))$
182 integrate(sin(x)^3,x);
186 integrate(%e^x/(%e^x+2),x);
188 integrate(1/(x*log(x)),x);
190 integrate(sin(2*x+3),x);
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$
201 2/(3*((2*x-1)^2/3+1))+(2*x-1)/(6*(x^2-x+1))-1/(3*(x+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"
209 is (file_search ("tests/test_readbase_lisp.lisp") = false);
212 is (file_search ("tests/rtest1.mac") = false);
215 /* verify that loading share packages via defsystem and retrieving documentation
216 * (both make use of *LOAD-PATHNAME*) do not cause errors
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 */