1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
2 /***************************************************************************
4 *** Copyright (c) 1984 by William Schelter,University of Texas *****
5 *** All rights reserved *****
6 ***************************************************************************/
19 expand(%*(sqrt(17)-4));
21 cf([1,2,-3]+[1,-2,1]);
24 ''(cfdisrep(cf(8/5)))$
30 matrix([265,97],[153,56])$
31 ev(%[1,2]/%[2,2],numer);
33 cf([1,2,-3]+[1,-2,1]);
36 ''(cfdisrep(cf(8/5)))$
42 matrix([265,97],[153,56])$
43 ev(%[1,2]/%[2,2],numer);
46 (foop1(L1, L2) := length(L1) <= length(L2) and L1 = makelist (L2[i], i, 1, length(L1)),
47 foop(L1, L2) := foop1(L1, L2) or last(L1) # 1 and foop1 (reverse (append ([1, last(L1) - 1], rest (reverse (L1)))), L2),
54 foop (%%, cf(rat(bfloat(expr)))));
59 foop (%%, cf(rat(bfloat(expr)))));
64 foop (%%, cf(rat(bfloat(expr)))));
67 (expr : 2^(1/3) + 3^(1/4) + 4^(1/5),
69 foop (%%, cf(rat(bfloat(expr)))));
72 (expr : sqrt(2) + 2^(2/3) + sqrt(17) - 11^(7/5),
74 foop (%%, cf(rat(bfloat(expr)))));
84 [2, 1, 4, 1, 4, 1, 4]$
86 (reset (ratepsilon), 0);
95 map(lambda([u],partfrac(u,x)),x+1/(x^3+4*x^2+5*x+2));
96 1/(x+2)-1/(x+1)+1/(x+1)^2+x$
97 map(ratsimp,x/(x^2+x)+(y^2+y)/y);
99 map("=",[a,b],[-0.5,3]);
105 fullmapl("+",[3,[4,5]],[[a,1],[0,-1.5]]);
107 exp1:(a^2+2*a+1)*y+x^2;
114 f(f(f(u)*f(f(v)^f(f(f(a)*f(x))+f(b))))+f(c))$
115 append([y+x,0,-3.2],[2.5e+20,x]);
116 [y+x,0,-3.2,2.5e+20,x]$
117 my_union(x,y):=if x = [] then y
118 else (if member(t:first(x),y) then my_union(rest(x),y)
119 else cons(t,my_union(rest(x),y)));
120 my_union(x,y):=if x = [] then y
121 else (if member(t:first(x),y) then my_union(rest(x),y)
122 else cons(t,my_union(rest(x),y)))$
123 my_union([a,b,1,1/2,x^2],[-x^2,a,y,1/2]);
124 [b,1,x^2,-x^2,a,y,1/2]$
126 x^5-5*x^4/2+5*x^3/3-x/6$
127 maplist(numfactor,%);
131 factcomb(3*x/(2*3^x*x!));
134 /* mailing list 2015-11-10: "Problem integrating subbscripted and diff'ed function" */
136 (kill (x, t, a, b, foo), foo : diff (x[1](t), t));
139 integrate (foo, t, a, b);
145 (kill (k, l, u), foo : diff (x[k, l](t, u), u));
146 'diff (x[k, l](t, u), u);
148 integrate (foo, u, a, b);
149 x[k, l](t, b) - x[k, l](t, a);
154 foo : diff ((x[1](t))^3, t);
155 3*(x[1](t))^2*'diff(x[1](t), t);
157 expand (integrate (foo, t, a, b));
158 (x[1](b))^3 - (x[1](a))^3;
163 foo : diff (sin(x[1](t)), t);
164 cos(x[1](t))*'diff(x[1](t), t);
166 integrate (foo, t, a, b);
167 sin(x[1](b)) - sin(x[1](a));
172 /* SF bug #3921: "Expanded subtracted from unexpanded with e^ix does not integrate to zero" */
174 (f:%e^-(3*%i*x)*(sin(3*x)+x)-%e^-(3*%i*x)*sin(3*x)-x*%e^-(3*%i*x),
178 /* examples from the bug report */
180 integrate(f,x,0,2*%pi);
189 integrate(f,x,0,2*%pi);
192 integrate(f,x,0,-%pi);
195 integrate(f,x,0,3*%pi);
198 integrate(f,x,-%pi,%pi);
201 integrate(f,x,-%pi,2*%pi);
207 /* additional examples for #3921 */
210 integrate(f, x, a, b));
214 ratsimp (demoivre (%%)));