O Odsjeku

Kursevi na Odsjeku
Vijesti sa Odsjeka
Studijske grupe
Zaposleni na Odsjeku
Adresa
English version

Novosti

Održani seminari
Posjete u organizaciji Odsjeka
Istraživačka interesovanja Odsjeka
Novosti iz svijeta fizike

Istorija fizike

Mehanika
Termodinamika
Elektromagnetizam
Optika
Atomska fizika

Kongres2008
Prvi kongres fizičara Bosne i Hercegovine

ICPS2008

 

ICPS2009


2005 - Godina fizike

 

 
Vi ste posjetilac od 23.03.2000. godine

Dobrodošli na www.fizika.rs.ba

 

Studentski linkovi

E-mail
Bolonjski proces
Savjeti za ispite
Brucoška stranica :)
Kako korisno provesti ljeto?
Linkovi iz svijeta fizike
Zadaci sa Olimpijade za fizičare
Zadaci sa Republičkog takmičenja iz fizike 2008. godine
Mala škola računara
Maple
Origin

Zanimljivosti iz fizike

Nobelovci
Izreke poznatih fizičara
Čuveni srpski fizičari
 
Index
Webmaster

 
Maple exercises

Zoran Rajilic, zoran@urc.bl.ac.yu
Physics Department, Faculty of Science, Banja Luka
2001

PREFACE

Maple is a computer algebra system (CAS), an extensive software system for symbolics, numerics and graphics. In 1980 Geddes and Gonnet started development of Maple at the University of Waterloo (Ontario, Canada). In 1988 Waterloo Maple Software has been founded to develop the system further. Using Maple one can do differentiation, calculation of limits, integration, algebraic and differential equations solving, matrix operations, plotting, animation, statistical analysis... Maple is useful at teaching and learning of physics as well as in research and technical applications.
We write a Maple statement after the ">" prompt and then press Enter. To obtain help, we use "?".
If you wish to exercise the using of Maple, you can write the following statements and consider Maple answers. The introduction in every section is the suitable part of Maple Help. The sections are ordered alphabetically. There are many possible starting points in your exercises.

?introduction
?worksheet

Abbreviation
?macro
macro(a=arccos):
a(0);
a(4/5);

A..B
?seq
seq(exp(m),m=5..14);
Sum(v^k,k=1..60);
Int(x^4,x=0..9);
Product(sin(i),i=1..6);

Animation
?animate
?animate3d
with(plots):
animate(1/cosh((x-0.2*t)/3)^2,x=0..100,t=0..450,numpoints=250);
animate3d([cos(1+t*y),y,x],x=1..6,y=1..6,t=0..7,coords=spherical);

Arithmetic Operators
?+
(5+9-4)*5/7;
3^2, 4^2, 2^3;
1/2, evalf(1/2);
evalf(1654/798,64);
1654.0/798;
I^2;
(6-2*I)^3;
(a+b-c)^x;
b-2*a-b^2+12*a+b/5-a/6+3*b-b^2/8+b*2*b-11*a;

Assignment
?assignment
p:=12:
p-2;
c:=5: c+b;
c:='c': c+b;
x:=y: y:=z: z:=t: t:=251: x;
f:=cos(v);
plot(f,v=-3*Pi..3*Pi);
w:=3: cos(w); subs(q=3,cos(q));

Assume
?assume
int(exp(-a*t),t=0..infinity);
assume(a>0):
int(exp(-a*t),t=0..infinity);

Bessel Functions
?Bessel
dsolve(x^2*diff(y(x),x,x)+x*diff(y(x),x)-(x^2+nu^2)*y(x)=0,y(x));
dsolve(x^2*diff(y(x),x,x)+x*diff(y(x),x)+(x^2-nu^2)*y(x)=0,y(x));
BesselI(2,3.8);
plot(BesselJ(1,x),x=0..15);

Collection of Coefficients
?collect
collect(c*y^2-3*y+(c-y)^2,y);
collect((x-ln(x))^3+(ln(x)+5)^2,ln(x));
collect(sum(x^i,i=2..7)*sum(y^j,j=1..4),x);
collect(sum(x^i,i=2..7)*sum(y^j,j=1..4),y);
collect((sin(x)+a+b)^4,sin(x));
collect(5*diff(f(t),t)-4*f(t)^2+t^2*diff(f(t),t)=0,diff);

Combinat Package
?combinat
with(combinat):
choose([v,n,g,s,h,k,b],4);
randcomb([phi,psi,omega,beta],3);

Complex Numbers
?I
I^2;
z:= 4.5-7.2*I;
Re(z), Im(z), abs(z), argument(z);
conjugate(z);
Digits:=79: 2/z;
z:=12+23*I:
(z^4-z^3+z)*(1+I);

Composition
?@
(tan@cosh)(x);
(exp@ln)(z);
(sin@arcsin)(x);
(sqrt@arccos)(t);

Convert an Expression to a Different Form
?convert
convert(2.725,rational);
convert(1/4,float);
convert(3*Pi/4,degrees);
convert(sin(x),exp);
convert(tan(3*x).sincos);
convert(arctanh(2*x-1),ln);

Curl of a Vector Field
?curl
with(linalg): r:=[x,y,z]:
curl([0,b*x,0],r);
curl([exp(-z),x*y*z,-x^3*tan(x/y)],r);

Data Analysis
?stats
with(stats):
xdata:=[1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5]:
ydata:=[8.65,7.32,6.86,5.28,4.30,3.77,4.24,5.81,6.04,7.92,8.53,9.62]:
plots[display](statplots[scatter2d](xdata,ydata),view=[0.5..7,3..10]);
fit[leastsquare[[x,y],y=a*x^2+b*x+c]]([xdata,ydata]);

Differential Operator
?D
f:= x->x^4;
D(f);
D(f)(b);
(D@D)(f);
g:= (x,y)->sin(x)/y;
D[1](g);
D[2](g);

Differentiation
?diff
H:=Diff(x^3,x);
value(H);
diff(x,x);
diff(exp(x),x);
diff(sin(x),x);
diff(ln(y),y);
diff(sin(5*t),t);
B:=Diff(x^5,x,x);
value(B);
C:=Diff(x^5,x$2);
value(C);
diff(x^5,x,x), diff(x^5,x$2);
diff(cos(2*t),t,t,t), diff(cos(2*t),t$3);
diff(y^5,y$5);
diff(u*ln(u)-exp(3*u^2)*tan(u)^3,u$4);
diff(int(f(x),x),x);

Divergence of a Vector Field
?diverge
with(linalg): r:=[x,y,z]:
diverge([a*x,b*y,c*z],r);
diverge(curl([f(x,y,z),g(x,y,z),h(x,y,z)],r),r);

Evaluation to Floating-Point Number
?evalf
3/4;
evalf(3/4);
evalf(Pi);
evalf(Pi,61);
evalf(tan(2));
evalf(3/(3+8*I));
int(2^sin(x),x=0..4);
evalf(int(2^sin(x),x=0..4));

Expansion
?expand
expand((y+z)^2);
expand((a+b)^2*(h-c)^3);
expand((pi-rho)*(chi+psi));
expand(sin(alpha+beta));
expand(exp(sum(s[k],k=1..10)));

Exponential Function
?exp
exp(x);
evalf(exp(1));
plot(exp(u),u=-2..2);
limit((1+x/n)^n,n=infinity);
expand(exp(a+b));
series(exp(z),z=0);
evalc(exp(I*x));

Extraction of Operands
?op
B:=4+ggg-3*p+fib;
op(1,B);
op(4,B);
knj:=3*ii*wdd*nn;
op(3,knj);
op(4,mu-nu-xi-theta);

Factorization
?factor
factor(1-2*p+p^2);
factor(6+3*w-s*w-2*s);
A:=sum((2*a)^k,k=0..9);
factor(A);
B:=diff(x^2/(1-x),x$3);
factor(B);

For Statement
?for
for j from 4 by 3 to 30 while j^2<150 do print(j/(j+1)) od;
for i from 1 to 11 do s(i):=sqrt(1+s(i-1)) od;
for j from 1 to 10 do diff(x*sin(x)^2,x$j) od;
for k from 1 to 56 do sum(n^2,n=1..k) od;

Functions
?->
f:= x->x/ln(x);
f(x);
f(4.3);
w:= (u,v)->u^2-v^3;
w(u,v);
w(a,b);
w(2,1);

Geometry
?geometry
with(geometry):
point(A,1,1),point(B,2,2),point(C,1,-2):
segment(AB,[A,B]): segment(BC,[B,C]):
draw(AB,axes=none);
draw({AB,BC},axes=none);
triangle(T,[point(A1,1,-1),pont(A2,-3,5),point(A3,4,1)]):
draw(T,axes=none);
area(T);
point(A,3,6):
circle(c,[A,4]):
draw(c);

Gradient of a Scalar Field
?grad
with(linalg): r:=[x,y,z]:
grad(1/z,r);
grad(exp(-b*y),r);
grad(1/sqrt(x^2+y^2+z^2),r);

Hermite, Laguerre and Legendre Polynomials
?orthopoly
with(orthopoly):
H(2,x);
L(2,x);
P(4,x);

If Statement
?if
c:=3/8: v:=4/9:
if c<v-1 then 111 elif c<v then rrr elif c=v then 3 else uuu fi;
if int(x^3,x=-8..7)>0 then tttw else yyyh fi;
if sum(1/3^m,m=0..34)<1 then skyyy else alttt fi;

Integral Transforms
?inttrans
with(inttrans):
fourier(exp(-x^2),x,t);
laplace(cos(3*x),x,t);

Integration
?int
Y:=Int(ln(1-x),x);
value(Y);
int(diff(f(x),x),x);
int(x,x);
int(cos(y),y);
int(1/u,u);
int(sin(t/2)*exp(3-t),t);
int(cos(y^2),y);
M:=int(cos(y^3),y);
series(M,y=0);
Int(cos(x),x=3..7);
int(cos(x),x=3..7);
int(x/(exp(x)-1),x=0..infinity);
B:=int(sqrt(exp(z)+sin(z)),z=1..5);
evalf(B);
int(1/sqrt(x),x=0..3,'CauchyPrincipalValue');
int(f(z)*Dirac(z),z=-infinity..infinity);

Laurent Series Expansion
?numapprox
with(numapprox):
laurent(cos(x)/(x-1)^2,x=1,5);

Left (Right) Hand Side of an Expression
?lhs
rr3:= a+sin(rho)=b-tan(delta);
lhs(rr3);
rhs(rr3);

Limit
?limit
Q:=Limit(sin(x)/x,x=0);
value(Q);
limit(exp(-v),v=infinity);
limit(3/y+5,y=infinity);
limit((x^4-1)/(x-1),x=1);

Logarithm
?log
exp(ln(y));
simplify(2^log[2](y));
simplify(10^log[10](y));
log[10](10);
log[10](5.9);

Matrices
?matrices
with(linalg):
A:=matrix(3,3,[2,0,4,a,b,c,0,1,1]);
B:=matrix(2,3,[6,7,8,0,4,0]);
H:=matrix(3,3,[4,3,2,1,0,1,c,a,b]);
evalm(A+2*H);
evalm(B&*A);
evalm(A^(-1));
det(H);

Maximum (Minimum) of Numbers
?max
max(288,289,2e2);
min(1/788,4/623,2e-3);

Normalization of a Rational Expression
?normal
normal(1/a-3/c);
normal((1-x)/(x^2-3)+3/(x-2));
normal(2/(4*a-3)+3/(4*a+3)-(16*a-6)/(16*a^2-9));
normal(((x-1)/(x+1)-(y-1)/(y+1))/(1+(x-1)*(y-1)/((x+1)*(y+1))));

Numerator and Denominator
?denom
numer(x/y);
denom(x/y);
q:= sin(t+6)/ln(t-1);
numer(q)^2-denom(q)^3;

Pattern Matching
?match
match((x+5)^2=a*x^2+b*x+c,x,p);
p;
match(2*z^3+6*z^2+6*z+2=(phi*z+delta)^3,z,q);
q;
allvalues(q);

Plot of Functions
?plot
?plot3d
plot(t*cos(t),t=0..3*Pi);
plot({x^2,exp(-x)},x=-1..2);
plot(abs(v),v=-1..1);
plot(Heaviside(x)+1,x=-2..2);
plot(signum(t),t=-10..10);
plot(exp(-u/8)*cos(u),u=0..18,thickness=3,color=magenta);
g:=y*ln(y)/(y+4*exp(y)):
plot(g,y=1..11);
plot3d(3*exp(-x*y)*cos(3*x+3*y)^2,x=0..3,y=0..3,numpoints=2000);

Plotting of Differential Equation Numerical Solution
?DEplot
difj:= diff(u(z),z$2)+3*diff(u(z),z)-2*cos(u(z))=0:
with(DEtools):
DEplot(difj,u(z),z=2..9,[[u(0)=1/3,D(u)(0)=-2]],stepsize=0.01);

Plotting of Partial Differential Equation Numerical Solution
?PDEplot
eq4:= w(x,y)*diff(w(x,y),x)+diff(w(x,y),y)=y*w(x,y);
with(DEtools):
PDEplot(eq4,w(x,y),[0,t,exp(t)],t=0..0.3,y=0..0.8,w(x,y)=0.2,stepsize=0.05);

Procedures
?proc
w:= proc(t) t/cos(t) end:
w(k);
b:= proc(x,y) if x>y then x/y else y/(x+y) fi end:
b(3,2);
b(2,3);
h:= proc(n) if n=1 then 1/2 else 1-q*h(n-1)^2 fi end:
plot({h(31),h(32)},q=0..2);

Product
?product
R:=Product(ln(j),j=3..15);
value(R);
product(4^k,k=0..7);
product(c[i],i=1..18);
product(n,n=1..j);

Rationalization of Denominator
?rationalize
rationalize(delta/(2+sqrt(3)));
rationalize(z/(5-8*I));
z:=4/(3-I):
rationalize(z^3-z*I);

Restart
?restart
y:=4:
y-3;
restart:
y-3;

Root
?root
root[3](8);
root[5](45.7), root[8](45.7);
root[9](V)^9;

Series Expansion
?series
series(exp(x),x=0);
series(exp(x),x=0,55);
series(sin(x),x=0);
series(ln(x),x=1);
series(exp(cos(t^2+1)),t=1);

Sequence Operator
?$
physics$3;
b[j]$j=5..9;
k^3$k=4..11;
diff(sin(z),z$2);
diff(exp(-2*y),y$3);

Simplification
?simplify
A:=ln((2*sin(x)^2+3*cos(x)^2)/(4+2*cos(x)^2));
simplify(A);
W:=diff(sqrt(x/(1-x^3)),x$8);
simplify(W);
a:= proc(n) if n=1 then delta else 1/(1-a(n-1)) fi end:
a(17);
simplify(a(17));

Solving Equations
?solve
solve(5-x=x+2,x);
solve({x+y=5,x-y=1},{x,y});
eq1:= 3*a-b=0: eq2:= c+3*a=1: eq3:= 2*b+c=2:
solve({eq1,eq2,eq3},{a,b,c});
solve(2*z^2+7*z-4,z);
solve(5*a^2-9*a-2=0,a);
solve(343*y^3+125=0,y);
solve(x^4-26*x^2+25=0,x);

Solving of Ordinary Differential Equations
?dsolve
dsolve({diff(f(x),x)=-k*f(x),f(0)=a},f(x));
dsolve({diff(s(t),t,t)=1-3*diff(s(t),t), s(0)=1,D(s)(0)=0},s(t));
dsolve({diff(w(t),t,t)=1-2*diff(w(t),t)^2,w(0)=1,D(w)(0)=0},w(t));

Solving of Partial Differential Equations
?pdesolve
aaa:= y*diff(h(x,y),y)+x*diff(h(x,y),x)=h(x,y)/4;
pdesolve(aaa,h(x,y));

Square Root
?sqrt
sqrt(z), sqrt(3);
sqrt(b)^2;
sqrt(3.0), evalf(sqrt(3));
evalf(sqrt(2),89);
plot(sqrt(t),t=0..2);
sqrt(-1);
evalf(sqrt(2+3*I));

Statement Separators
?;
a:b;
a;b:
h:=diff(exp(y^3),y$4);abs(h);
h:=diff(exp(y^3),y$4):abs(h);

Student Package
?student
f(x):= 1/4+cos(2*x)+8*sqrt(x)/9:
with(student):
leftbox(f(x),x=0..2.5,25);
leftsum(f(x),x=0..2.5,25);

Summation
?sum
S:=Sum(2^k,k=1..9);
value(S);
sum(2^k,k=1..9);
G:=sum(exp(3*j),j=0..10);
evalf(G);
H:=sum(cos(n),n=5..18);
evalf(H);
sum(10^m,m=0..5);

Substitution
?subs
subs(x=3,cos(x));
subs(t=n,exp(t^2+1));
subs(y=2,sqrt(y)), subs(y=2.0,sqrt(y));
g:=diff(1/sin(x^2),x$3);
evalf(subs(x=3,g));

True, False, Fail
?true
is(2<3);
is(2>3);
is(vodenica<s);
is(cos(Pi)>=-1);
is(sin(Pi/2)<=1);

Type of an Expression
?whattype
whattype(35488);
whattype(7865.32);
whattype(79/42);
whattype(vodaivatra);
whattype(x+7=8);
whattype(tan(t));

Unapply
?unapply
w:=t^4-5*t+7:
g:=unapply(w,t);
g(x);
rj11:= dsolve({diff(v(t),t)=1-t^3*v(t)^2,v(0)=1},v(t));
h:= unapply(rhs(rj11),t);
h(z-3);

Vectors
?linalg
a:=[a1,a2,a3]; b:=[b1,b2,b3];
3*a+2*b;
with(linalg)
dotprod(a,b);
crossprod(a,b);
norm(a,2);
norm(a-b,2);

Wrong and Correct
?contents
b+4*b # wrong
b+4*b; # correct
p-4p; # wrong
p-4*p; # correct
exp(2,5); # wrong
exp(2.5); # correct
by=4; # wrong
bx=5, bu=6, b=7, rrb=9; # correct
if+2; # wrong
h+4, kkmm+2, medvjed+5; # correct
diff(x^4); # wrong
diff(x^4,x); # correct
limit(t=0,t/sin(t)); # wrong
limit(t/sin(t),t=0); #correct
solve(y+2:=b+3,y); # wrong
solve(y+2=b+3,y); # correct
subs(z:=2,ln(z)); # wrong
subs(z=2,ln(z)); # correct
collect((a-x+2)^3); # wrong
collect((a-x+2)^3,x); # correct
N:=5: I:=6: # wrong
N:=5: i:=6: # correct
x:=3: int(tan(x),x); # wrong
x:='x': int(tan(x),x); # correct
jedn33= y+8=y^2-1; # wrong
jedn33:= y+8=y^2-1; # correct
plot(exp(t)); # wrong
plot(exp(t),t=-1..1); # correct
if 2^3<2*5 then yesyes else nono; # wrong
if 2^3<2*5 then yesyes else nono fi; # correct
for n from 3 to 9 do evalf(sinh(n),74); # wrong
for n from 3 to 9 do evalf(sinh(n),74) od; # correct
meh:= proc(y) y*exp(-y): # wrong
meh:= proc(y) y*exp(-y) end: # correct


References

AltaVista: www.altavista.com
Char B W, Geddes K O, Gonnet G H, Leong B L, Monagan M B and Watt S M 1991 Maple V Language Reference Manual (New York: Springer)
Cheb-Terrab Edgardo S: lie.uwaterloo.ca/ecterrab
Cheb-Terrab E S and McLenaghan R G (eds) 1998 Computer Algebra in Physics Research, Computer Physics Communications vol. 115, 93-570
Computer Algebra: archives.math.utk.edu/topics/computerAlgebra.html
Experiments in Mathematics Using Maple (Dodson and Gonzalez):
www.ma.umist.ac.uk/kd/ednet/maths/maple/readme.html
Geddes Keith O: daisy.uwaterloo.ca/~kogeddes
Gonnet Gaston H: www.inf.ethz.ch/personal/gonnet
Google: www.google.com
Govorukhin V and Tsybulin V 1997 Introduction to Maple (Moscow: Mir)
Greene R 1995 Classical Mechanics with Maple (New York: Springer)
History of Maple: daisy.uwaterloo.ca/SCG/history.html
Introduction to Maple (Lehigh): www.lehigh.edu:80/~ludoc/imp/ib6/ib6.shtml
Introduction to Maple (Purdue University): www.physics.purdue.edu/comphelp/maple/maple.html
Introduction to Maple (University of Illinois): www.math.uic.edu/maple/labs/index.html
Journal of Symbolic Computation: www.academicpress.com/jsc
Lycos: www.lycos.com
Maple at MIT: web.mit.edu/afs/athena.mit.edu/software/maple/www/home.html
Maple Books: web.mit.edu/afs/athena/software/maple/www/plibrary/books-eng.html
Maple Help Sheets (K.G. TeBeest): www.kettering.edu/acad/scimath/appmath/maple
Maple Reporter: www.adeptscience.co.uk/products/mathsim/maple5/reporter
Maple resources (University of Haifa): math.haifa.ac.il/maple.html
Maple Tutorial (C. Team): saaz.lanl.gov/Maple/Maple_Home.html
Maple (University of Buffalo): wings.buffalo.edu/computing/sc/maple.html
Maple User Group Answers: www-math.math.rwth-aachen.de/MapleAnswers
Maple V (A.F. Walz): www.math.utsa.edu/mirrors/maple
Maple V (Mannheim): krum.rz.uni-mannheim.de/ca-info/cas-maple.html
Maple V (N. Geers): www.uni-karlsruhe.de/~Maple
Mathematics Archives: xxx.lanl.gov/find/math
Modern Physics and Maple: www.fis.unb.br/jario/Maple/Aplicado/FiscaModerna/maplepg4.htm
Physics Archives: xxx.lanl.gov/find/physics
Queen's University Maple links page: grtensor.phy.queensu.ca/maple2.html
Redfern D 2000 The Maple Handbook (New York: Springer)
Software for Mathematics: www.ams.org/mathweb/mi-software.html
Software Packages: www.bham.ac.uk/ctimath/gateway/packages.htm
Symbolic Computation Group Home Page: daisy.uwaterloo.ca
Waterloo Maple Software: www.maplesoft.com
Yahoo: dir.yahoo.com/Science/Mathematics/Software/MAPLE
Zimmermann Paul: www.loria.fr/~zimmerma

gore gore

Odsjek fizike, PMF Banjaluka

Sviđaju mi se relativnost i kvantna teorija.
Doduše, ništa o njima jasno ne uspevam da naučim,
ali vidim da se u njima prostor pomera, uvija
kao labud na vodi kad ga neki nemir muči.
Uzalud mu prilaziš sa metrom i satom,
za merenje prostora nikad nije pravi dan.
Jer neku volju, vidite, ima i atom,
pa svaki čas menja svoje htenje i plan.

D. H. Lorens

Google
Pretražite WWW Pretražite fizika.rs.ba