Arman Akbarian
UNIVERSITY OF BRITISH COLUMBIA
PHYSICS & ASTRONOMY DEPT.

> 1+3/2;
 

`/`(5, 2) (1)
 

> 2.381+1/2;
 

2.881000000 (2)
 

> %+2;
 

4.881000000 (3)
 

> Pi;
 

Pi (4)
 

> evalf(Pi,20);
 

3.1415926535897932385 (5)
 

> evalf(1+1/3,6);
 

1.33333 (6)
 

> evalf(sqrt(2),8);
 

1.4142136 (7)
 

> sqrt(3);
 

`*`(`^`(3, `/`(1, 2))) (8)
 

> evalf(sin(0.2));
 

.1986693308 (9)
 

> Digits := 5;
 

`:=`(Digits, 5) (10)
 

> evalf(sin(0.2));
 

.19867 (11)
 

> I^2;
 

-1 (12)
 

> exp(1);
 

exp(1) (13)
 

> evalf(exp(I),4);
 

`+`(.5403, `*`(.8415, `*`(I))) (14)
 

> sin(Pi/4);
 

`+`(`/`(`*`(`^`(2, `/`(1, 2))), `*`(2))) (15)
 

> (1+x)+(2*x+5);
 

`+`(6, `*`(3, `*`(x))) (16)
 

> expand((1+y)^2);
 

`+`(1, `*`(2, `*`(y)), `*`(`^`(y, 2))) (17)
 

> factor(z^3+6*z^2+3*z-10);
 

`*`(`+`(z, `-`(1)), `*`(`+`(z, 2), `*`(`+`(z, 5)))) (18)
 

> diff(sin(x),x);
 

cos(x) (19)
 

> Sum(1/2^2,n);
 

Sum(`/`(1, 4), n) (20)
 

> value(%);
 

`+`(`/`(`*`(n), `*`(4))) (21)
 

> sum(1/2^2,n);
 

`+`(`/`(`*`(n), `*`(4))) (22)
 

> A := 2;
 

`:=`(A, 2) (23)
 

> B := sqrt(A);
 

`:=`(B, `*`(`^`(2, `/`(1, 2)))) (24)
 

> C := x + y;
 

`:=`(C, `+`(x, y)) (25)
 

> x := 1.0;
 

`:=`(x, 1.0) (26)
 

> y := 2.0;
 

`:=`(y, 2.0) (27)
 

> C;
 

3.0 (28)
 

> restart;
 

> x;
 

x (29)
 

> y := x^2 + 3*x + 1;
 

`:=`(y, `+`(`*`(`^`(x, 2)), `*`(3, `*`(x)), 1)) (30)
 

> eval(y,x=2);
 

11 (31)
 

> z:=cos(x)^5+sin(x)^4+2*cos(x)^2-2*sin(x)^2-cos(2*x);
 

`:=`(z, `+`(`*`(`^`(cos(x), 5)), `*`(`^`(sin(x), 4)), `*`(2, `*`(`^`(cos(x), 2))), `-`(`*`(2, `*`(`^`(sin(x), 2)))), `-`(cos(`+`(`*`(2, `*`(x))))))) (32)
 

> simplify(z);
 

`*`(`^`(cos(x), 4), `*`(`+`(cos(x), 1))) (33)
 

> f := x -> (x-1)*(x+1)*(x-3);
 

`:=`(f, proc (x) options operator, arrow; `*`(`+`(x, `-`(1)), `*`(`+`(x, 1), `*`(`+`(x, `-`(3))))) end proc) (34)
 

> f(3);
 

0 (35)
 

> f(a);
 

`*`(`+`(a, `-`(1)), `*`(`+`(a, 1), `*`(`+`(a, `-`(3))))) (36)
 

> plot(f(x),x=-2..4);
 

Plot_2d
 

> A := {1,2,5};
 

`:=`(A, {1, 2, 5}) (37)
 

> map(f,A);
 

{-3, 0, 48} (38)
 

> B := {-1,1,3};
 

`:=`(B, {-1, 1, 3}) (39)
 

> map(f,B);
 

{0} (40)
 

> E := map(cos,A);
 

`:=`(E, {cos(1), cos(2), cos(5)}) (41)
 

> E[2];
 

cos(2) (42)
 

> G := {sin(x),cos(x),exp(x)};
 

`:=`(G, {cos(x), exp(x), sin(x)}) (43)
 

> eval(G[2],x=0);
 

1 (44)
 

> restart;
 

> A := array(1..3);
 

`:=`(A, array(1 .. 3, [])) (45)
 

> A[1] := 0;
 

`:=`(A[1], 0) (46)
 

> A[2] := Pi/3;
 

`:=`(A[2], `+`(`/`(`*`(Pi), `*`(3)))) (47)
 

> A[3] := Pi/2;
 

`:=`(A[3], `+`(`/`(`*`(Pi), `*`(2)))) (48)
 

> map(sin, A);
 

Vector[row](%id = 139429460) (49)
 

> B := array(1..3,1..3,[[1,3,6],[2,4,5],[3,7,9]]);
 

`:=`(B, Matrix(%id = 136099396)) (50)
 

> expr := z^2+1;
 

`:=`(expr, `+`(`*`(`^`(z, 2)), 1)) (51)
 

> subs({z=x+y},expr);
 

`+`(`*`(`^`(`+`(x, y), 2)), 1) (52)
 

> expr2 := a^3*b^2;
 

`:=`(expr2, `*`(`^`(a, 3), `*`(`^`(b, 2)))) (53)
 

> myrule:={a*b=5};
 

`:=`(myrule, {`*`(a, `*`(b)) = 5}) (54)
 

> simplify(expr2,myrule);
 

`+`(`*`(25, `*`(a))) (55)
 

> simplify(expr2,{a=b});
 

`*`(`^`(b, 5)) (56)
 

> solve({x^3-13*x+12},{x});
 

{x = 1}, {x = 3}, {x = -4} (57)
 

> solve({x+y=3,x-y=8},{x,y});
 

{x = `/`(11, 2), y = -`/`(5, 2)} (58)
 

> eqn:={sin(x)=x/4};
 

`:=`(eqn, {sin(x) = `+`(`/`(`*`(x), `*`(4)))}) (59)
 

> fsolve(eqn,{x});
 

{x = 0.} (60)
 

> fsolve(eqn,{x}, 0.01..2*Pi);
 

{x = 2.474576787} (61)
 

> f:= sin(x+y)-exp(x)*y = 0:
 

> g:= x^2-y=2:
 

> fsolve({f,g});
 

{x = -6.017327250, y = 34.20822723} (62)
 

> fsolve({(x+1)^2=-2},x,complex);
 

{x = `+`(`-`(1.000000000), `-`(`*`(1.414213562, `*`(I))))}, {x = `+`(`-`(1.), `*`(1.414213562, `*`(I)))} (63)
 

> f := cos(x) -x;
 

`:=`(f, `+`(cos(x), `-`(x))) (64)
 

> eqn := f=0;
 

`:=`(eqn, `+`(cos(x), `-`(x)) = 0) (65)
 

> sol:=fsolve(eqn,{x});
 

`:=`(sol, {x = .7390851332}) (66)
 

> Digits := 30;
 

`:=`(Digits, 30) (67)
 

> eval(f,sol);
 

0.25373032244381498310e-10 (68)
 

> f:= x -> sin(x)/x;
 

`:=`(f, proc (x) options operator, arrow; `/`(`*`(sin(x)), `*`(x)) end proc) (69)
 

> limit(f(x),x=0,right);
 

1 (70)
 

> limit(tan(x),x=Pi/2,left);
 

infinity (71)
 

> P:= series(sin(x),x=0);
 

`:=`(P, series(`+`(x, `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `*`(`/`(1, 120), `*`(`^`(x, 5))))+O(`^`(x, 6)),x,6)) (72)
 

> P2 := convert(P,polynom);
 

`:=`(P2, `+`(x, `-`(`*`(`/`(1, 6), `*`(`*`(`^`(x, 3))))), `*`(`/`(1, 120), `*`(`*`(`^`(x, 5)))))) (73)
 

> plot({P2,sin(x)},x=-Pi..Pi,-Pi..Pi);
 

Plot_2d
 

> ode1 := diff(y(t),t,t) = -g - k*diff(y(t),t);
 

diff(diff(y(t), t), t) = `+`(`-`(g), `-`(`*`(k, `*`(diff(y(t), t))))) (74)
 

> ode2 := diff(x(t),t,t) = -k*diff(x(t),t);
 

diff(diff(x(t), t), t) = `+`(`-`(`*`(k, `*`(diff(x(t), t))))) (75)
 

> ics1 := y(0)=0,D(y)(0)=vy;
 

y(0) = 0, (D(y))(0) = vy (76)
 

> ics2 := x(0)=0,D(x)(0)=vx;
 

x(0) = 0, (D(x))(0) = vx (77)
 

> sol1:=dsolve({ode1,ics1});
 

y(t) = `+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(k, `*`(t))))), `*`(`+`(`*`(vy, `*`(k)), g))), `*`(`^`(k, 2)))), `-`(`/`(`*`(g, `*`(t)), `*`(k))), `/`(`*`(`+`(`*`(vy, `*`(k)), g)), `*`(`^`(k, 2)))) (78)
 

> sol2:=dsolve({ode2,ics2});
 

x(t) = `+`(`/`(`*`(vx), `*`(k)), `-`(`/`(`*`(vx, `*`(exp(`+`(`-`(`*`(k, `*`(t))))))), `*`(k)))) (79)
 

> assign(sol1);
 

> assign(sol2);
 

> x(t);
 

`+`(`/`(`*`(vx), `*`(k)), `-`(`/`(`*`(vx, `*`(exp(`+`(`-`(`*`(k, `*`(t))))))), `*`(k)))) (80)
 

> y(t);
 

`+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(k, `*`(t))))), `*`(`+`(`*`(vy, `*`(k)), g))), `*`(`^`(k, 2)))), `-`(`/`(`*`(g, `*`(t)), `*`(k))), `/`(`*`(`+`(`*`(vy, `*`(k)), g)), `*`(`^`(k, 2)))) (81)
 

 

> with(plots);
 

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
(82)
 

> vx:=1.0:vy:=1.0:g:=9.8:
 

> animate(plot,[[x(t),y(t),t=0..0.2]],k=0..10,trace=10,frames=100);
 

Plot_2d
 

>
 

> `:=`(f, proc (x, y) options operator, arrow; `*`(sin(x), `*`(cos(y))) end proc); 1
 

proc (x, y) options operator, arrow; `*`(sin(x), `*`(cos(y))) end proc (83)
 

> plot3d(f(x, y), x = 0 .. `+`(`*`(2, `*`(Pi))), y = 0 .. `+`(`*`(2, `*`(Pi)))); 1
 

Plot
 

>
 

> restart; 1
 

> `:=`(ode3, `+`(diff(y(x), x, x), `*`(2, `*`(z, `*`(w, `*`(diff(y(x), x))))), `*`(`^`(w, 2), `*`(y(x)))) = 0); 1
 

`+`(diff(diff(y(x), x), x), `*`(2, `*`(z, `*`(w, `*`(diff(y(x), x))))), `*`(`^`(w, 2), `*`(y(x)))) = 0 (84)
 

> `:=`(ices, y(0) = 1.0, (D(y))(0) = 0.); 1
 

y(0) = 1.0, (D(y))(0) = 0. (85)
 

> `:=`(sol3, dsolve({ices, ode3})); 1
 

y(x) = `+`(`/`(`*`(`/`(1, 2), `*`(`+`(`*`(`^`(z, 2)), `*`(z, `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `-`(1)), `*`(exp(`*`(`+`(`-`(z), `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `*`(...
y(x) = `+`(`/`(`*`(`/`(1, 2), `*`(`+`(`*`(`^`(z, 2)), `*`(z, `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `-`(1)), `*`(exp(`*`(`+`(`-`(z), `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `*`(...
(86)
 

> assign(sol3); 1
 

> y(x); 1
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`*`(`^`(z, 2)), `*`(z, `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `-`(1)), `*`(exp(`*`(`+`(`-`(z), `*`(`^`(`+`(`*`(`^`(z, 2)), `-`(1)), `/`(1, 2)))), `*`(w, `*`(... (87)
 

> `:=`(w, 1.0); 1
 

1.0 (88)
 

> animate(plot, [y(x), x = 0 .. 40], z = 0 .. .99, trace = 10, frames = 100); 1
 

Plot_2d
 

> restart; 1
 

> `:=`(f, proc (x) options operator, arrow; exp(sin(x)) end proc); 1
 

proc (x) options operator, arrow; exp(sin(x)) end proc (89)
 

> `:=`(g, D(f)); 1
 

proc (x) options operator, arrow; `*`(cos(x), `*`(exp(sin(x)))) end proc (90)
 

> diff(f, x); 1
 

0 (91)
 

> diff(f(x), x); 1
 

`*`(cos(x), `*`(exp(sin(x)))) (92)
 

> `:=`(h, diff(f(x), x)); 1
 

`*`(cos(x), `*`(exp(sin(x)))) (93)
 

> h(5); 1
 

`*`((cos(x))(5), `*`((exp(sin(x)))(5))) (94)
 

> g(5); 1
 

`*`(cos(5), `*`(exp(sin(5)))) (95)
 

> `:=`(t, proc (x, y) options operator, arrow; `*`(`^`(x, 2), `*`(sin(y))) end proc); 1
 

proc (x, y) options operator, arrow; `*`(`^`(x, 2), `*`(sin(y))) end proc (96)
 

> `:=`(P, D[2](t)); 1
 

proc (x, y) options operator, arrow; `*`(`^`(x, 2), `*`(cos(y))) end proc (97)
 

> `:=`(Q, D[1](t)); 1
 

proc (x, y) options operator, arrow; `+`(`*`(2, `*`(x, `*`(sin(y))))) end proc (98)
 

> `:=`(S, D[1, 2](t)); 1
 

D[1, 2](t) (99)
 

> restart; 1; `:=`(ode, diff(x(t), t, t) = `+`(`-`(sin(x(t))))); 1
 

diff(diff(x(t), t), t) = `+`(`-`(sin(x(t)))) (100)
 

> `:=`(ics, x(0) = 0, (D(x))(0) = 2); 1
 

x(0) = 0, (D(x))(0) = 2 (101)
 

> dsolve({ics, ode}); 1
 

x(t) = RootOf(`+`(`-`(Int(`/`(1, `*`(`^`(`+`(`*`(2, `*`(cos(_a))), 2), `/`(1, 2)))), _a = 0 .. _Z)), t)) (102)
 

> `:=`(sol, dsolve({ics, ode}, numeric)); 1
 

proc (x_rkf45) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if `<`(1, nargs) then error (103)
 

> sol(1); 1
 

[t = 1., x(t) = 1.73153917235197929, diff(x(t), t) = 1.29610910343914920] (104)
 

> with(plots); 1
 

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
(105)
 

> odeplot(sol, [t, x(t)], 0 .. 100); 1
 

Plot_2d
 

> `:=`(eq1, diff(x(t), t, t) = `+`(`-`(`/`(`*`(x(t)), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), `/`(3, 2))))), `-`(`/`(`*`(0.2e-1, `*`(x(t))), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))),...
 

diff(diff(x(t), t), t) = `+`(`-`(`/`(`*`(x(t)), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), `/`(3, 2))))), `-`(`/`(`*`(0.2e-1, `*`(x(t))), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), 2))... (106)
 

> `:=`(eq2, diff(y(t), t, t) = `+`(`-`(`/`(`*`(y(t)), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), `/`(3, 2))))), `-`(`/`(`*`(0.2e-1, `*`(y(t))), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))),...
 

diff(diff(y(t), t), t) = `+`(`-`(`/`(`*`(y(t)), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), `/`(3, 2))))), `-`(`/`(`*`(0.2e-1, `*`(y(t))), `*`(`^`(`+`(`*`(`^`(x(t), 2)), `*`(`^`(y(t), 2))), 2))... (107)
 

> `:=`(ics, x(0) = 5, y(0) = 0, (D(x))(0) = 0, (D(y))(0) = .1); 1
 

x(0) = 5, y(0) = 0, (D(x))(0) = 0, (D(y))(0) = .1 (108)
 

> `:=`(solarsol, dsolve({eq1, eq2, ics}, {x(t), y(t)}, numeric, range = 0 .. 200.0)); 1
 

proc (x_rkf45) local _res, _dat, _vars, _solnproc, _xout, _ndsol, _pars, _n, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if `<`(1, nargs) then error (109)
 

> solarsol(0); 1
 

[t = 0., x(t) = 5., diff(x(t), t) = 0., y(t) = 0., diff(y(t), t) = .100000000000000] (110)
 

> odeplot(solarsol, [x(t), y(t)], 0 .. 50.00, frames = 300); 1
 

Plot_2d
 

>
 


last update: Wed May 11, 2016