You are on page 1of 16

(Evalution)

(%i1)

kill(all)$

1 (Evalution)
1.1

: ev

[] ev(expr, arg_1, ..., arg_n) . . . . . arg_1, ..., arg_n expr


simp, expr
noeval,
nouns, (nons)
expand,
expand(m,n), maxposex , maxnegex m , n
detout, expr
diff, ,
derivlist(x, y, z, ...),
risch,
float,
numer,
pred , (predicates)
eval,
A , A (evaluation flag, evflag)
V:expression ( V=expression ), expr V expression
F , F (evaluation function, evfun )
F, ( sum) expr
F(x):= expression,

(%i1)

expr:sin(x) + cos(y) + (w+1)^2 + 'diff (sin(w), w);

(%o1)

cos (y) + sin (x) +

Maxima

d
sin (w) + (w + 1)2
dw

wxMaxima

(Evalution)

(%i2)

ev (expr, diff);

(%o2)

cos (y) + sin (x) + cos (w) + (w + 1)2

(%i3)

ev (expr, numer, expand, diff, x=2, y=1);

(%o3)

cos (w) + w2 + 2 w + 2.449599732693821

[] expr, arg_1, ..., arg_n

. . . . . . . . . . . . . . . . . .

ev

ev(expr, arg_1, ..., arg_n ) ev expr, arg_1, ..., arg_n


(%i4)

x+y, x: a+y, y: 2;

(%o4)

y+a+2

(%i5)

2*x - 3*y = 3$
-3*x + 2*y = -4$
solve ([2*x - 3*y = 3, -3*x + 2*y = -4]);
1
6
[[y = , x = ]]
5
5

(%o7)
(%i8)

x + 1/x > gamma (1/2),numer;


1
> 1.772453850905516
x

(%o8)

x+

(%i9)

x + 1/x > gamma (1/2),pred,x=1/2;

(%o9)

true

1.2

:evflag,evfun

evflag x evfun ev(expr,x) expr,x ev(expr,x=true)


:
algebraic, cauchysum, demoivre, dotscrules, %emode,%enumer, exponentialize, exptisolate,
factorflag, float, halfangles, infeval, isolate_wrt_times, keepfloat, letrat, listarith, logabs, logarc, logexpand, lognegint, lognumer, m1pbranch, numer_pbranch, programmode, radexpand,
ratalgdenom, ratfac, ratmx, ratsimpexpons, simp, simpproduct, simpsum, sumexpand, trigexpand
(%i10) sin (1/2);
(%o10)

( )
1
sin
2

Maxima

wxMaxima

(Evalution)

(%i11) sin (1/2), float;


(%o11) 0.4794255386042
declare(x, evfun) x evflag
(%i12) declare (aa, evflag);
(%o12) done
(%i13) if aa = true then YES else NO;
(%o13) N O
(%i14) if aa = true then YES else NO, aa;
(%o14) Y ES
evfun F evfun ev(expr,F) expr,F F(ev(expr))
declare(F, evfun) F evfun
evfun :
bfloat, factor, fullratsimp, logcontract, polarform, radcan, ratexpand, ratsimp, rectform, rootscontract, trigexpand, trigreduce.
(%i15)

x^3 - 1;

(%o15) x3 1
(%i16) x^3 - 1, factor;
(
)
(%o16) (x 1) x2 + x + 1
(%i17) cos(4 * x) / sin(x)^4;
(%o17)

cos (4 x)
sin (x)4

(%i18)

cos(4 * x) / sin(x)^4, trigexpand;

(%o18)

sin (x)4 6 cos (x)2 sin (x)2 + cos (x)4


sin (x)4

declare(F, evfun) F evfun


(%i19)

declare ([F, G], evfun);

Maxima

wxMaxima

(Evalution)
(%o19) done
(%i20) (aa : bb, bb : cc, cc : dd);
(%o20) dd
(%i21) aa;
ev(aa);
(%o21) bb
(%o22) cc
(%i23) aa,F;
(%o23)

F (cc)

(%i24) aa,F,G;
(%o24)

1.3

G ( F (cc))

: declare ,,,verbify,nounify

Maxima (Nouns ) (Verbs )

declare
(%i25) foo (x) := x/17;
foo(10);
declare (foo, noun)/**/;
foo(10);
(%o25)

foo (x) :=

x
17

10
17
(%o27) done
(%o26)

(%o28)

foo (10)

[]

[]

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Maxima

wxMaxima

(%i29) bar (x) := x^2;


bar (42);
(%o29)

bar (x) := x2

(%o30) 1764
(%i31) 'bar (42);
(%o31)

bar (42)

(%i32) integrate(cos(x),x);
diff(cos(x),x);
(%o32)

sin (x)

(%o33) sin (x)


(%i34) 'integrate(cos(x),x);
'diff(cos(x),x);

(%o34)

cos (x) dx

d
cos (x)
dx
[] verbify(f) f nounify(f) f
nounify(f) C
(%o35)

(%i36)

verbify ('foo);
nounify (foo);

(%o36) f oo
(%o37) f oo

2
2.1

: first,last,rest,lhs,rhs,numfactor

[] first(exp)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

[] last(exp)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

[] rest(exp,n) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
[] lhs(eqn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Maxima

wxMaxima

(%i38)

e: aa + bb = cc;

(%o38) cc + bb = dd
(%i39)

lhs (e);

(%o39) cc + bb
[] rhs(eqn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
(%i40) rhs (e);
(%o40) dd
(%i41) [rhs (aa < bb), rhs (aa <= bb), rhs (aa >= bb),

rhs (aa > bb)];


(%o41) [cc, cc, cc, cc]
(%i42) e1: '(foo(x) := 2*x);

e2: '(bar(y) ::= 3*y);

e3: '(x : y);

e4: '(x :: y);


(%o42)

foo (x) := 2 x

(%o43)

bar (y) ::= 3 y

(%o44) x : y
(%o45) x :: y
(%i46) [rhs (e1), rhs (e2), rhs (e3), rhs (e4)];
(%o46) [2 x, 3 y, y, y]
[] numfactor(exp) . . . . . . . . . . . . . . . . . . . . . . . . . . .
(%i47)

gamma (7/2);

Maxima

wxMaxima

15
(%o47)
8
(%i48)
(%o48)

2.2

numfactor (%);
15
8

:reveal,pickapart,isolate,disolate

[] revel(exp,n
(%i49)
(%o49)

. . . . . . . . . . . . . . . . . . . . . exp n

e: expand ((a - b)^2)/expand ((exp(a) + exp(b))^2);


b2 2 a b + a2
2 eb+a + e2 b + e2 a

(%i50) reveal (e, 1);


(%o50) Quotient
(%i51) reveal (e, 2);
(%o51)

Sum (3)
Sum (3)

(%i52) reveal (e, 3);


(%o52)

Expt + N egterm + Expt


Product (2) + Expt + Expt

(%i53) reveal (e, 4);


(%o53)

b2 Product (3) + a2
2 Expt + e Product (2) + e Product (2)

(%i54) reveal (e, 5);


(%o54)

b2 2 a b + a2
2 e Sum (2) + e2 b + e2 a

(%i55) reveal (e, 6);


b2 2 a b + a2
2 eb+a + e2 b + e2 a
[] pickapart (expr, n) n %tN

(%o55)

Maxima

wxMaxima

(%i56)

expr: (a+b)/2 + sin (x^2)/3 - log (1 + sqrt(x+1));

(%o56) log

) sin (x2 ) b + a
x+1+1 +
+
3
2

(%i57) pickapart (expr, 0);


(%t57)

log

) sin (x2 ) b + a
x+1+1 +
+
3
2

(%o57) %t57
(%i58) pickapart (expr, 1);
(%t58)

log

)
x+1+1

sin (x2 )
3
b+a
(%t60)
2
(%o60) %t60 + %t59 + %t58
(%t59)

(%i61) pickapart (expr, 2);

(%t62)

)
x+1+1
( )
sin x2

(%t63)

b+a

(%o63)

%t63 %t62
+
%t61
2
3

(%t61)

log

(%i64) pickapart (expr, 5);


(%t64)
(%o64)

x+1

(
)
sin (x2 ) b + a
+
log
%t64 + 1
3
2

(%i65) pickapart (expr, 6);


(%o65)
[]

(
)
sin (x2 ) b + a
+
log
x+1+1
3
2
isolate (expr, x) . expr x

(%i66) isolate (expand ((a+b+c)^2), c);

Maxima

wxMaxima


(%t66)

b2 + 2 a b + a2

(%o66) c2 + 2 b c + 2 a c + %t66
[]

isolatew rtt imes[f alse]

. . . . . . . . . . . . . . . . . . . . . . true

(%i67)

isolate_wrt_times: true$
isolate (expand ((a+b+c)^2), c);
isolate_wrt_times: false$

(%t68)

2a

(%t69)

2b

(%o69) c2 + %t69 c + %t68 c + %t66


[]

disolate(expr, x,y,...) expr x ,t,..

(%i71)

isolate_wrt_times: true$
disolate (expand ((a+b+c)^2), a,c);
isolate_wrt_times: false$

(%t72)

b2

(%o72) c2 + 2 a c + %t69 c + a2 + %t69 a + %t72


[] exptisolate[false] . . . . . . . . . . . . . . . . . . . . . . . . . .
(%i74) exptisolate:flase$
isolate_wrt_times: true$
(%i76) isolate (expand ((a+b+c)^2+%e^(3*a*c)), c);
isolate_wrt_times: false$
(%o76) e

2.3
[]

3 %t68 c
2

+ c2 + %t69 c + %t68 c + %t66

:part,ipart,dpart,piece,allbut
part (expr, n_1, ..., n_k)

. . . . . . . . . . . . . . . . . . . . . . .

(%i78) part(z+2*y+a,2);
(%o78) 2 y
[]

ipart (expr, n_1, ..., n_k) . . . . . . . . . . . . . . . . . . . . . . .

(%i79) exp:x+y+w*z;
inpart(exp,3,2);
Maxima

wxMaxima


(%o79) w z + y + x
(%o80) z
(%i81) part(exp,1,2);
(%o81) z
(%i82) expr:'limit (f(x)^g(x+1), x, 0, minus);

inpart (expr,1,2);
(%o82)

lim f (x) g (x+1)

x0

(%o83)

g (x + 1)

[]

dpart (expr, n_1, ..., n_k) . . . . . . . . . . . . . . . . . . . . . . .

(%i84) dpart(z+2*y+a,2);
(%o84) z + (2 y) + a
[] piece part substpart

(%i85)

expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1;

(%o85) 27 y 3 + 54 x y 2 + 36 x2 y + y + 8 x3 + x + 1
(%i86)

part (expr, 2, [1, 3]);

(%o86) 54 y 2
(%i87) sqrt (piece/54);
(%o87) |y|
[] allbut(arg1,...,argn) part ,inpart,substpart,substinpart ,

(%i88) expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1;


part(expr,allbut(1, 3));
(%o88) 27 y 3 + 54 x y 2 + 36 x2 y + y + 8 x3 + x + 1
(%o89) 54 x y 2 + y + 8 x3 + x + 1
Maxima

10

wxMaxima

2.4

:subst,sublis, substpart,substinpart,ratsubst

[] subst(a,b,expr) . . . . . . . . . . . . . . a expr b
(%i90) subst (a, x+y, x + (x+y)^2 + y);
(%o90) y + x + a2
[]

subst ([eq_1, ..., eq_k], expr)

eq_1, ..., eq_k expr

(%i91) subst ([(x+y)=d,y=3], x + (x+y)^2 + y);


(%o91) x + d2 + 3
[]

sublis ([eq_1, ..., eq_k], expr) eq_1, ..., eq_k expr

subst (lhs)
(%i92) sublis ([x=d,y=(3+e)], x + (x+y)^2 + y);
(
(%o92)

)2
b 2 2 a b + a2
b2 2 a b + a2
+
d
+
+
3
+3
d + b+a
2 e + e2 b + e2 a
2 eb+a + e2 b + e2 a

[] substpart (x, expr, n_1, ..., n_k)

. . . . . . . . . . . . . . . . . . . .

(%i93) expr: 27*y^3 + 54*x*y^2 + 36*x^2*y + y + 8*x^3 + x + 1;


substpart (factor (piece), expr, [1, 2, 3, 5]);
(%o93) 27 y 3 + 54 x y 2 + 36 x2 y + y + 8 x3 + x + 1
(%o94) (3 y + 2 x)3 + y + x + 1
(%i95) expr: 1/x + y/x - 1/z;
1 y 1
(%o95) + +
z x x
(%i96) substpart (xthru (piece), expr, [2, 3]);
y+1 1

x
z
[] substinpart (x, expr, n_1, ..., n_k)
(%o96)

. . . . . . . . . . . . . . . . . . .

(%i97) x . 'diff (f(x), x, 2);


substinpart (d^2, %, 2);
Maxima

11

wxMaxima


d2
f (x)
d x2
(%o98) x.d2
(%o97) x.

(%i99) substinpart (f[a], f[1](x + 1), 0);


(%o99) fa (x + 1)
[] ratsubst((a, b, c) a expr b, subst ratsubst

(%i100) expr:x^4*y^3 + x^4*y^8$


ratsubst (a, x*y^2, expr);
(%o101) a x3 y + a4
(%i102) subst (a, x*y^2, expr);
(%o102) x4 y 8 + x4 y 3
[] radsubstflag [false]

. . . . . . .

(%i103) radsubstflag: false$

ratsubst (u, sqrt(x), x);


(%o104) x
(%i105) radsubstflag: true$

ratsubst (u, sqrt(x), x);


radsubstflag: false$
(%o106) u2

2.5

: opsubst,

[] opsubst (f,g,e) . . . . . . . . . . . . . . . . . . .

subst (opsubst:true)
(%i108) load('opsubst)/* boolean opsubst */$
opsubst(f,g,g(g(x)));

Maxima

12

wxMaxima


(%o109) f ( f (x))
(%i110) opsubst(f,g,g(g));
(%o110) f (g)
(%i111) opsubst(f,g[x],g[x](z));
(%o111) f (z)
(%i112) opsubst(g[x],f, f(z));
(%o112) gx (z)
(%i113) opsubst(tan, sin, sin(sin));
(%o113) tan (sin)
[] opsubst[true]

. . . . . . . . . . . . true ,subst

(%i114) subst(f,g,g(g(x)));
(%o114) f ( f (x))
(%i115) subst(tan, sin, sin(sin));
(%o115) tan (tan)
(%i116) opsubst:false;
subst(f,g,g(g(x)));
(%o116) f alse
(%o117) g ( g (x))

2.6
[]

: delete ,rempart
delete (expr1, expr2[,n]) . . . . . . . . . . . . . . .

(%i118) delete (y, [w, x, y, z, z, y, x, w]);


(%o118) [w, x, z, z, x, w]

Maxima

13

wxMaxima

(%i119) delete (sin(x), x + sin(x) + y);


(%o119) y + x

(%i120) delete (u - x, (u - w)*(u - x)*(u - y)*(u - z));


(%o120) (u w) (u y) (u z)

(%i121) delete (a, foo (a, b, c, d, a));


(%o121) foo (b, c, d)
delete
(%i122) delete ((x + y)*(x - y), [(x + y)*(x - y), x^2 - y^2]);
(%o122) [x2 y 2 ]
[]

rempart (expr, n) . . . . . . . . . . . . . . . . . . . . . . . . . .

bug ?
(%i123) load(functs);
expr: a*b+c*(d+e)+k;
length(expr);
part(expr,1);
inpart(expr,1);
rempart(expr,2);
(%o123) C : /ADE/programs/M axima/share/maxima/5.29.1/share/simplif ication/f uncts.mac
)
(
b2 2 a b + a2
(%o124) k + c d + b+a
+ ab
2 e + e2 b + e2 a
(%o125) 3
(%o126) k
(%o127) a bM aximaencounteredaLisperror : ErrorinM ACSY M AT OP LEV EL[oracallee] :K
is not of type LIST.Automatically continuing.To enable the Lisp debugger set *debugger-hook*
to nil.
[] first(exp)

2.7

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

: op,args

Maxima

14

wxMaxima

dispform,dispterms

(%i129) expr:a+b*c/e;
op(expr);
args(expr);
(
)
b 2 eb+a + e2 b + e2 a c
(%o129)
+a
b2 2 a b + a2
(%o130) +
(
)
b 2 eb+a + e2 b + e2 a c
(%o131) [
, a]
b2 2 a b + a2

2.8

listofvars

[] listofvars (expr)

. . . . . . . . . . . . . .

expr

(%i132) listofvars (f (x[1]+y) / g^(2+a));


(%o132) [g, a, x1 , y]

3 dispform,dispterms
[] dispform (expr[,all]) expr (external representation), all

(%i133) expr : sin (sqrt (x));


(%o133) sin

( )
x

(%i134) freeof (sqrt, expr);


(%o134) true
(%i135) freeof (sqrt, dispform (expr));
(%o135) true
(%i136) freeof (sqrt, dispform (expr, all));
(%o136) f alse
[] dispterms (expr)

Maxima

. . . . . . . . . . . . . expr ,

15

wxMaxima

dispform,dispterms

(%i137) dispterms(a+2*b-d/(k+h)*l);
+

dl
2 ba
k+h

(%o137) done

Maxima

16

wxMaxima

You might also like