1 /*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
2 /***************************************************************************
4 *** Copyright (c) 1984 by William Schelter,University of Texas *****
5 *** All rights reserved *****
6 ***************************************************************************/
13 atvalue(f(x,y),[x = 0,y = 1],a^2);
15 atvalue('diff(f(x,y),x),x = 0,y+1);
17 printprops(all,atvalue);
19 diff(4*f(x,y)^2-u(x,y)^2,x);
20 8*f(x,y)*'diff(f(x,y),x,1)-2*u(x,y)*'diff(u(x,y),x,1)$
22 16*a^2-2*u(0,1)*(''(at('diff(u(x,y),x,1),[x = 0,y = 1])))$
23 atvalue(f(x,y),[x = 0,y = 1],a^2);
25 atvalue('diff(f(x,y),x),x = 0,y+1);
27 printprops(all,atvalue);
29 diff(4*f(x,y)^2-u(x,y)^2,x);
30 8*f(x,y)*'diff(f(x,y),x,1)-2*u(x,y)*'diff(u(x,y),x,1)$
32 16*a^2-2*u(0,1)*(''(at('diff(u(x,y),x,1),[x = 0,y = 1])))$
33 listofvars(f(x[1]+y)/g^(2+a));
35 coeff(2*a*tan(x)+tan(x)+b = 5*tan(x)+3,tan(x));
37 coeff(y+x*%e^x+1,x,0);
43 islinear(exp,var):=block([c],c:bothcoef(rat(exp,var),var),
44 is(freeof(var,c) and c[1] # 0));
45 islinear(exp,var):=block([c],c:bothcoef(rat(exp,var),var),
46 is(freeof(var,c) and c[1] # 0))$
47 islinear((r^2-(x-r)^2)/x,x);
49 (a+b)^4*(1+x*(2*x+(c+d)^2));
50 (b+a)^4*(x*(2*x+(d+c)^2)+1)$
51 (linenum:0,isolate(%,x));
54 2*%t2*x^2+%t1*%t2*x+%t2$
56 2*(b+a)^4*x^2+(b+a)^4*(d+c)^2*x+(b+a)^4$
61 (a+b)*(x+a+b)^2*%e^(x^2+a*x+b);
62 (b+a)*(x+b+a)^2*%e^(x^2+a*x+b)$
63 block([linenum:2],ev(isolate(%,x),exptisolate:true));
64 %t3*%t4*(x+%t3)^2*%e^(x^2+a*x)$
69 exp1:integrate(1/(x^3+2),x);
70 -log(x^2-2^(1/3)*x+2^(2/3))/(6*2^(2/3))+atan((2*x-2^(1/3))/(2^(1/3)*sqrt(3)))
72 +log(x+2^(1/3))/(3*2^(2/3))$
73 /* got this at one point but it differentiates ok
74 -2^(1/3)*log(2^(2/3)*x^2-2*x+2*2^(1/3))/12+2^(1/3)*atan((2*2^(2/3)*x-2)/(2*sqrt(3)))/(2*sqrt(3))+2^(1/3)*log(x+2^(1/3))/6; */
77 block([linenum:4],pickapart(exp1,1));
83 'diff(y,x,2)+'diff(y,z,3)*2+'diff(y,x,1)*x^2;
84 2*'diff(y,z,3)+'diff(y,x,2)+x^2*'diff(y,x,1)$
87 (%i*v+u)/(f+%i*e)+%e^(%i*alpha);
88 (%i*v+u)/(f+%i*e)+%e^(%i*alpha)$
90 (e*v+f*u)/(f^2+e^2)+cos(alpha)$
91 rectform(sin(2*%i+x));
92 cosh(2)*sin(x)+%i*sinh(2)*cos(x)$
94 sqrt(cosh(2)^2*sin(x)^2+sinh(2)^2*cos(x)^2)
95 *%e^(%i*atan2(sinh(2)*cos(x),cosh(2)*sin(x)))$
96 rectform(log(3+4*%i));
99 sqrt(log(5)^2+atan(4/3)^2)*%e^(%i*atan(atan(4/3)/log(5)))$
103 ev(rectform((2+3.5*%i)^0.25),numer);
104 0.3682587918166914*%i+1.368266274774369;
106 1.416956998795383*%e^(0.2629125531370934*%i);
107 /* %emode:false is needed to keep above answer from being converted out of polar form
108 before being compared to result of polarform() */
112 delete(sin(x),x+sin(x)+y);
119 /* simplification of 'at' */
121 kill (f, g, h, u, v, w, x, y, z, a, b, c);
124 at (f (x, y, z), x = a);
127 '(at (f (x, y, z), x = a));
128 at (f (x, y, z), x = a);
130 '('at (f (x, y, z), x = a));
131 'at (f (x, y, z), [x = a]);
133 at (f (x, y), z = b);
136 '(at (f (x, y), z = b));
137 at (f (x, y), z = b);
139 '('at (f (x, y), z = b));
142 at ('f (x, y), [x = a, y = b]);
145 '(at ('f (x, y), [x = a, y = b]));
146 at ('f (x, y), [x = a, y = b]);
148 '('at ('f (x, y), [x = a, y = b]));
149 'at ('f (x, y), [x = a, y = b]);
151 at (diff (f (x, y), x, 1, y, 1), [x = a, y = b]);
152 'at ('diff (f (x, y), x, 1, y, 1), [x = a, y = b]);
154 at (diff (f (x, y), x, 1, y, 1), x = a);
155 'at ('diff (f (x, y), x, 1, y, 1), [x = a]);
157 at (at (diff (f (x, y), x, 1, y, 1), [x = a, y = b]), a = c);
158 'at ('diff (f (x, y), x, 1, y, 1), [x = c, y = b]);
160 at (at (diff (f (x, y), x, 1, y, 1), [x = a, y = b]), c = z);
161 'at ('diff (f (x, y), x, 1, y, 1), [x = a, y = b]);
166 at (diff (x, y), [u = 1, v = 2, w = 3, z = 4]);
167 'at ('diff (x, y, 1), [z = 4]);
169 at (sum (f(a), a, 1, b), [a = x]);
170 'sum (f(a), a, 1, b);
172 at (sum (f(a), a, 1, b), [b = x]);
173 'sum (f(a), a, 1, x);
175 '('at ('sum (f(a), a, 1, b), [b = x]));
176 'at ('sum (f(a), a, 1, b), [b = x]);
178 at ('integrate (f(x), x), x = y);
179 'at ('integrate (f(x), x), [x = y]);
181 at ('integrate (f(x), x, a, b), x = y);
182 'integrate (f(x), x, a, b);
184 at ('laplace (f(t), t, s), [t = a, s = b]);
185 'laplace (f(t), t, b);
187 a : at (taylor (f(x), x, 0, 3), [x = 7/5]);
188 (343*('at('diff(f(x),x,3),x = 0)))/750+(49*('at('diff(f(x),x,2),x = 0)))/50
189 +(7*('at('diff(f(x),x,1),x = 0)))/5+f(0)$
191 b : subst (f = cos, a);
192 (343*('at('diff(cos(x),x,3),x = 0)))/750
193 +(49*('at('diff(cos(x),x,2),x = 0)))/50+(7*('at('diff(cos(x),x,1),x = 0)))/5
199 (taylor (cos(x), x, 0, 3), ev (%%, x=7/5));
200 ''(rat(1/50)); /* not a vanilla 1/50 ... */
205 at('at('diff(f(x,a),x,1),x=y),a=z);
206 'at('diff(f(x,z),x,1),x=y);
208 at('at('diff(f(x,a),x,1),x=y),y=z);
209 'at('diff(f(x,a),x,1),x=z);
211 at(diff(f(x),x),s=0);
214 at('diff(f(x,n),x,m),n=2);
217 at('diff(f(x,n),x,m),m=2);
220 /* from mailing list 2015-12-08: "Evaluate derivative in Maxima" */
223 f1(x):=diff(f(x),x,1),
224 f2(x):=diff(f(x),x,2),
225 x0(s):=mu+s*at(f1(x),x=mu)/(1/sigma^2-s*at(f2(x),x=mu)),
226 g(s,x):=s*f(x)-1/2*((x-mu)/sigma)^2,
227 g2(s,x):=diff(g(s,x),x,2),
228 g0(s):=at(g(s,x),x=x0(s)),
229 g20(s):=at(g2(s,x),x=x0(s)),
230 h(s):=1/sigma*exp(g0(s))*sqrt(1/abs(g20(s))),
231 at(diff(h(s),s,1),s=0));
232 (sigma*abs(sigma)*('at('diff(f(x),x,2),x = mu)))/2+(f(mu)*abs(sigma))/sigma$
234 (h(s):=s*(at(f1(x),x=mu)),
235 at(diff(h(s),s),s=0));
236 'at('diff(f(x),x,1), x=mu);
238 /* SF bug #1085: "Function \"at\" is overly cautious" */
240 at('integrate(f(t),t,0,x),x=0);
243 at('integrate(f(t),t,x,y),[x=a, y=b]);
244 'integrate(f(t),t,a,b);
246 /* SF bug #2302: "'at' applied to definite integral" */
248 at(integrate(f(t),t,0,x),x=0);
251 /* SF bug #3607: " printprops displays matchdeclare properties incorrectly when value is a lambda" */
253 apply (kill, propvars (matchdeclare));
256 matchdeclare (aa, all, bb, integerp, cc, lambda([x], floatnump(x) and x > 0));
259 printprops (all, matchdeclare);
260 [all(aa), integerp(bb), lambda([x], floatnump(x) and (x > 0))(cc)];