Вы находитесь на странице: 1из 38

Chng 1.

Ngi son: Trn Cng Mn

Khoa Ton - i Hc Khoa Hc Hu


1. Cc tnh ton c bn trong Gii tch
1.1. Cc tnh ton n gin
Maple c th c s dng nh mt my tnh in t thng thng, hn na n c th tnh
ton n 2^28 ch s nguyn (iu ny ph thuc vo tc v b nh ca my tnh). i
vi nhng s m di ca n qu chiu di ca mn hnh th Maple s dng k hiu \
biu din tnh lin tc ca dy s.

V d
> 2+2;

4
> (3 + 7 + 10)*(1000 - 8)/(900 + 90 + 2) - 17;
3
> 2^1000;
10715086071862673209484250490600018105614048117055336074437503883703 \
5105112493612249319837881569585812759467291755314682518714528569 \
2314043598457757469857480393456777482423098542107460506237114187 \
7954182153046474983581941267398767559165543946077062914571196477 \
686542167660429831652624386837205668069376
> 100!;
93326215443944152681699238856266700490715968264381621468592963895217 \
5999932299156089414639761565182862536979208272237582511852109168 \
64000000000000000000000000
> length(%);

158
Mt s hm thng s dng khi tnh ton trn cc s nguyn:
abs:
tnh gi tr tuyt i ca mt biu thc
factorial (hoc !)
iquo:

tnh giai tha ca mt s nguyn


tm thng trong php chia nguyn

irem:

tm phn d trong php chia nguyn

iroot:

tnh xp x cn nguyn ca mt s nguyn

isqrt:

tnh xp x cn bc 2 ca mt s nguyn

max, min:

cho ra gi tr ln nht v nh nht ca mt tp cc s

mod:

tnh ng d s hc

ifactor:

phn tch s nguyn ra thnh cc tha s nguyn t

isprime:

kim tra tnh nguyn t ca mt s nguyn

..........
Mt khc, Maple c th tnh ton xp x cc hng s c bit hoc cc biu thc n sai s
m ngi s dng mong mun.

V d
> Pi;
> evalf(Pi);

3.141592654
> evalf[100](Pi);
3.141592653589793238462643383279502884197169399375105820974944592307 \
816406286208998628034825342117068
> ln(exp(4));

4
Vi s phc, Maple s dng k hiu I biu din cho cn bc hai ca -1. Maple cn c lnh
cho php ta chuyn i cc s t h m ny sang h m khc.

V d
> (2+5*I)+(1-I);

4I

7
25

1
I
25

> (1+I)/(3+4*I);

> convert(247,binary);

11110111
> convert(1023,hex);

3FF
> convert(10,base,8);

[ 2, 1 ]

Ngoi ra n cn c nhiu hm tnh ton m mt my tnh thng thng khng c

V d
1. Cho ra 100 s nguyn t u tin
> seq(ithprime(i),i=1..99);
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,
191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277,
281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383,
389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487,
491, 499, 503, 509, 521, 523
2. Tm c s chung ln nht, bi s chung nh nht ca cc s
> gcd(1923456,1256872);
8
> lcm(24,15,7,154,812);

267960

1.2. Tnh ton trn biu thc


Maple cung cp mt b cng c kh y lm vic vi cc biu thc ton hc. V mt tnh
ton ta c th khai trin biu thc, rt gn biu thc, phn tch biu thc thnh cc a
thc,...hoc c th chuyn biu thc thnh nhng cu trc khc c nh ngha trong maple.

Cc php tnh c bn
Khai trin biu thc
S dng lnh expand. Xem cc v d sau:
> poly := (x+1)*(x+2)*(x+5)*(x-3/2);

poly := ( x

1) (x

2) (x

5) x

3
2

> expand( poly );

x4

13 3
x
2

5 x2

31
x
2

15

> expand( (x+1)*(y^2-2*y+1) / z / (y-1) );


x y2
2xy
x
y2
2y
1
z (y 1) z (y 1) z (y 1) z (y 1) z (y 1) z (y 1)
> expand( sin(2*x) );

2 sin( x ) cos( x )
> ln( abs(x^2)/(1+abs(x)) );

ln

x
1

> expand(%);

2 ln( x ) ln( 1

x)

> expand( (x+1)*(y+z), x+1 );#khai trien giu nguyen (x+1)


(x 1) y (x 1) z
Ngoi ra ta cng c th khai trin biu thc trn cc min c bit
> poly := (x+2)^2*(x-2)*(x+3)*(x-1)^2*(x-1);
poly := ( x 2 )2 ( x 2 ) ( x 3 ) ( x 1 )3
> expand( poly );
x7 2 x6 10 x5 12 x4

37 x3

10 x2

52 x

24

> % mod 3;

x7

2 x6

2 x5

x3

x2

2x

x7

2 x6

2 x5

x3

x2

2x

> Expand( poly ) mod 3;


>
Tp hp cc h s cng cp ca biu thc
S dng lnh collect gom cc h s cng cp trong biu thc li vi nhau. Xem cc v d:
> collect( x^2 + 2*x + 1 - a*x + b - c*x^2, x );
( 1 c ) x2 ( 2 a ) x b 1
> poly := x^2 + 2*y*x - 3*y + y^2*x^2;
poly := x2 2 x y 3 y

y2 x2

> collect( poly, x );

(1

y2 ) x2

2xy

3y

3) y

x2

> collect( poly, y );

y2 x2

(2 x

> trig_expr := sin(x)*cos(x) + sin(x) + y*sin(x);


trig_expr := sin( x ) cos( x ) sin( x ) y sin( x )
> collect( trig_expr, sin(x) );
( cos( x ) 1

y ) sin( x )

> DE := diff(f(x),x,x)*sin(x) - diff(f(x),x)*sin(f(x))


+ sin(x)*diff(f(x),x) + sin(f(x))*diff(f(x),x,x);
d2
d
d
d2
DE :=
f
(
x
)
sin
(
x
)
f
(
x
)
sin
(
f
(
x
)
)
sin
(
x
)
f
(
x
)
sin
(
f
(
x
)
)
f( x )
dx
dx
dx 2
dx 2
> collect( DE, diff );

( sin( f( x ) )

sin( x ) )

d
f( x )
dx

( sin( x )

sin( f( x ) ) )

d2
f( x )
dx 2

Ch : ta khng th dng lnh trn gom theo tng hoc tch


> big_expr := z*x*y + 2*x*y + z;
big_expr := z x y 2 x y z
> collect( big_expr, x*y );
Error, (in collect) cannot collect x*y

Tuy nhin, ta c th gom biu thc theo nhiu bin cng mt lc


> poly := x*y + z*x*y + y*x^2 - z*y*x^2 + x + z*x;
poly := x y z x y y x2 z y x2 x z x
> collect( poly, [x,y] );#gom lan luot
( 1 z ) y x2 ( ( 1 z ) y 1

z) x

> collect( poly, [x,y], distributed ); #gom cung luc


( 1 z ) x ( 1 z ) x y ( 1 z ) y x2
Phn tch biu thc thnh cc tha s
phn tch mt biu thc ra thnh tch cc tha s ta s dng lnh factor. Xem cc v d sau:
> factor( x^2-1 );
(x 1) (x 1)
> factor( x^3+y^3 );

(x

y ) ( x2

xy

y2 )

> rat_expr := (x^16 - y^16) / (x^8 - y^8);


x 16 y 16
rat_expr := 8
x y8
> factor( rat_expr );

y8

x8

> rat_expr := (x^16 - y^16) / (x^7 - y^7);


x 16 y 16
rat_expr := 7
x y7
> factor(rat_expr);
( x y ) ( x2 y2 ) ( x4 y4 ) ( y8 x8 )
y6 x y5 x2 y4 x3 y3 x4 y2 x5 y x6
Lu rng ty vo h s ca biu thc m lnh factor cho cc kt qu khc nhau.
> poly := x^5 - x^4 - x^3 + x^2 - 2*x + 2;
poly := x5 x4 x3 x2 2 x 2
> factor( poly );

(x

1 ) ( x2

2 ) ( x2

1)

> expand( sqrt(2)*poly );


2 x5
2 x4
2 x3
2 x2 2 2 x

2 2

> factor( % );

2 ( x2

1) (x

2 ) (x

2 ) (x

1)

> poly := x^4 - 5*x^2 + 6;

poly := x4

5 x2

> factor( poly );

( x2
> factor( poly, sqrt(2) );
( x2

2 ) ( x2

3) (x

3)

2 ) (x

2)

> factor( poly, { sqrt(2), sqrt(3) } );


(x
2 ) (x
2 ) (x
3 ) (x

3)

Ngoi ra, lnh Factor cho php phn tch biu thc thnh cc tha s trn cc trng c bit
> Factor( x^2+3*x+3 ) mod 7;
(x 6) (x 4)
> Factor( x^3+1 ) mod 5;

( x2

4x

1) (x

1)

>
a biu thc v dng chun
S dng lnh normal thc hin vic ny. Lnh ny thng p dng i vi cc biu thc c
cha phn s, n s quy ng mu s v rt gn cc thnh phn chung a biu thc cho
v dng rt gn nht c th. Xt cc v d sau:
> normal( x + 1/x );
x2 1
x
> expr := x/(x+1) + 1/x + 1/(1+x);
x
1
expr :=
x 1 x

1
x

> normal( expr );

1
x

> expr := (x^2 - y^2) / (x-y)^3;


expr :=

x2 y2
( x y )3

> normal( expr );


y x
( x y )2

> expr := (x - 1/x) / (x-2);


1
x
2

x
expr :=

> normal( expr );


x2 1
x (x 2)

> normal( expr, expanded ); #khai trien mau so


x2 1
x2 2 x
> normal( [ expr, exp(x+1/x) ] ); #thuc hien tren ds cac bieu thuc
x2 1
,e
x (x 2)

1
x

> big_expr := sin( (x*(x+1)-x)/(x+2) )^2


+ cos( (x^2)/(-x-2) )^2;
(x

big_expr := sin

1) x
x 2

cos

x2
x 2

> normal( big_expr );


sin

x2
x

cos

x2
x

c bit: lnh normal c th tr v biu thc dng khai trin m dng ny khng n gin hn
dng ban u. Trong nhng trng hp ny ta nn s dng lnh factor.
> expr := (x^25-1) / (x-1);
x 25 1
expr :=
x 1
> normal( expr );
1 x 15 x x 2 x 3 x 4
x9

x 14

x 13

x5

x7

x 16

x 24

x 12

x 19

x 18

x 17

> factor(expr);
( x4 x3 x2 x 1 ) ( x20

x15

x10

x5

x 22

x 23

x 21

x 20

x8

x6

x 11

x 10

1)

n gin biu thc


n gin mt biu thc ta thng dng lnh simplify. Lnh ny s tm dng n gin hn ca
biu thc c cho hin th ra kt qu. Xt cc v d sau:
> expr := 4^(1/2) + 3;
expr := 4 3
> simplify( expr );

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


expr := cos( x )5 sin( x )4 2 cos( x )2 2 sin( x )2 cos( 2 x )
> simplify( expr );

cos( x )4 ( cos( x )

1)

Nu mun p dng mt s quy lut c bit trong lng gic, trong cc hm logarit, hoc trong
cc hm m th ta phi ch cho maple bit.
> expr := ln(3*x) + sin(x)^2 + cos(x)^2;
expr := ln( 3 x ) sin( x )2 cos( x )2
> simplify( expr, trig ); #trigonometric: luong giac
ln( 3 x ) 1
> simplify( expr, ln );
ln( 3 )

ln( x )

sin( x )2

cos( x )2

> simplify( expr);

ln( 3 ) ln( x ) 1
Ta cng c th n gin biu thc vi gi thit cho trc
> expr := sqrt( (x*y)^2 );
expr := x2 y2
> simplify( expr );
x2 y2

> simplify( expr, assume=real );

xy
> simplify( expr, assume=positive );
xy
>
Sp xp biu thc
i khi ta nhp vo mt biu thc, v d nh mt a thc, th Maple c th hin th a thc
nhng khng sp xp theo ng th t bc ca a thc. sp xp li a thc theo th t
gim dn ca bc ta dng lnh sort. Xem cc v d:
> poly := 1 + x^4 - x^2 + x + x^3;
poly := 1 x4 x2 x x3
> sort( poly );

x4

x3

x2

x4

x3

x2

> poly;
> sort( x+x^3 + w^5 + y^2 + z^4, [w,x,y,z] );
w5 z4 x3 y2 x
> sort( x^3*y + y^2*x^2, [x,y] );

x3 y

x2 y2

> sort( x^3*y + y^2*x^2 + x^4, [x,y] );


x4 x3 y x2 y2
> sort( x^3*y + y^2*x^2 + x^4, [y,x] );
y2 x2 y x3 x4
>
>

Mt s lnh khc
Lnh convert: chuyn biu thc v mt dng xc inh
> convert(cos(x),exp);
1 (x I) 1 ( I x)
e
e
2
2

> convert(1/2*exp(x)+1/2*exp(-x),trig);
cosh( x )
> restart;
> A:=Matrix([[a,b],[c,d]]);
A :=

a
c

b
d

> convert(A,'listlist');

[ [ a, b ], [ c, d ] ]
> convert(A,'set');

{ a, b, c, d }
> convert(%,'list');
[ a , b , c, d ]

Lnh combine: t hp cc thnh phn ca biu thc


> combine( sin(x)^2 + cos(x)^2 );
1
> combine( sin(x)*cos(x) );

1
sin( 2 x )
2
> combine( exp(x)^2 * exp(y) );
(2 x
e

y)

> combine( (x^a)^2 );

(2 a)

thy c tng bc thc hin ca lnh ny ta thc hin nh sau:

> infolevel[combine] := 1;
infolevel combine := 1

> expr := Int(1, x) + Int(x^2, x);


expr := 1 dx

x 2 dx

> combine( expr );


combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:
combine:

combining
combining
combining
combining
combining
combining
combining
combining
combining
combining
combining
combining
combining
combining

with
with
with
with
with
with
with
with
with
with
with
with
with
with

respect
respect
respect
respect
respect
respect
respect
respect
respect
respect
respect
respect
respect
respect

to
to
to
to
to
to
to
to
to
to
to
to
to
to

linear
linear
linear
cmbpwr
power
power
power
cmbplus
cmbpwr
power
cmbpwr
power
power
power

x 2 dx

>
>
Lnh map: c tc dng p dng mt dng (biu thc, gi tr, hm, ...) ln ton b cu trc d
liu cho trc.
> map(f,[a,b,c]);
[ f( a ), f( b ), f( c ) ]
> ds:=[0,Pi/2,2*Pi/3,2*Pi];

ds := 0,

2
,2
2 3
,

> map(sin,ds);
0, 1 ,

3
,0
2

> ds1:=[sin(x),ln(x),x^2];
ds1 := [ sin( x ), ln( x ), x2 ]
> map(Diff,ds1,x);

d
d
d
sin( x ), ln( x ), ( x2 )
dx
dx
dx
> map(value,%);

cos( x ),

1
,2x
x

> map(x->x^2,[-1,0,1,2,3]);
[ 1, 0, 1, 4, 9 ]

>

Lnh series: to mt chui khai trin (hay khai trin Taylor) ca biu thc
> series(sin(x),x=0,10);
1 3
1 5
1 7
1
x
x
x
x
x9
6
120
5040
362880

O( x10 )

> series(exp(x),x=0,5);

> series(log(x),x=1,5);
1
1
1
x 1
( x 1 )2
( x 1 )3
(x
2
3
4

1 2
x
2

1 3
x
6

1 )4

1 4
x
24

O( x5 )

1 )5 )

O( ( x

> f(x):=(1+x)^n;

f( x ) := ( x
> series(f(x),x=0,5);
n (n 1) 2 n (n 1) (n
1 nx
x
2
6

2)

x3

1 )n

n (n

1) (n 2) (n
24

3)

x4

O( x5 )

1.3. Gii phng trnh v h phng trnh


Lnh solve
- y l lnh thng c s dng gii phng trnh hoc h phng trnh.
V d
> solve({x^2=4},{x});
{ x 2 }, { x -2 }
> solve({a*x^2+b*x+c=0},{x});
b
b2 4 a c
b
b2 4 a c
{x
}, { x
}
2a
2a
> solve({x+y=0});
{x

y, y

y}

> solve({x^3-13*x+12},{x});#Maple hieu bieu thuc dau bang 0


{ x 1 }, { x 3 }, { x -4 }
> solve({x+2*y=3,y+1/x=1},{x,y});#giai he phuong trinh
1
{ x -1, y 2 }, { x 2, y
}
2

> eqns := {x +
y +
z = 3,
x + 2*y + 3*z = 6,
x + 4*y + 9*z = 14};
eqns := { x y z 3, x 2 y 3 z 6, x 4 y

9 z 14 }

> solve(eqns);

{ x 1, z 1, y 1 }
>
> restart;
- Khi ta gii phng trnh v thu c nghim th nghim c cho dng tp hp. Ta c
th s dng cc lnh bit chuyn dng nghim trn v cc cu trc d liu khc nh danh
sch.
V d
> sol:=solve({x+2*y=3,y+1/x=1},{x,y});
1
sol := { x -1, y 2 }, { x 2, y
}
2
> convert(sol[1],list);

[ x -1, y 2 ]
> eval([x,y],sol[1]);

[ -1, 2 ]
> eval([y,x],sol[1]);

[ 2, -1 ]
> restart;
- i khi phng trnh c nhiu nghim nhng Maple khng hin th ht nghim m ch hin th
mt vi nghim, ta s dng thm lnh sau buc Maple biu din ht nghim.
V d
> eqn:=sin(Pi*x/4)=cos(Pi*x/4);
x
x
eqn := sin
cos
4
4
> solve(%,{x});

{x 1}
> _EnvAllSolutions:=true;
_EnvAllSolutions := true
> solve(eqn,{x});

{ x 1 4 _Z1~ }
Ta c th thy c cc nghim ca phng trnh ny thng qua vic v th sau:
> plot(sin(Pi*x/4)-cos(Pi*x/4),x=-12..12,scaling=constrained);

Lnh unapply
- Lnh ny cho php xc nh hm s t biu thc v cc bin.
V d
> f := unapply(x^2 + y^2 + 4, x, y);
f := ( x, y ) x2 y2 4
> f(a,b);

a2

b2

> eqn1 := x+2*y+3*z+4*t+5*u=41:


eqn2 := 5*x+5*y+4*z+3*t+2*u=20:
eqn3 := 3*y+4*z-8*t+2*u=125:
eqn4 := x+y+z+t+u=9:
eqn5 := 8*x+4*z+3*t+2*u=11:
> s1 := solve({eqn1,eqn2,eqn3,eqn4,eqn5}, {x,y,z,t,u});
s1 := { t -11, z -1, y 3, x 2, u 16 }
> s2 := solve({eqn1,eqn2,eqn3}, { x, y, z});

527
13

s2 := { x

7t

28 u
,z
13

70
13

59 u
,y
13

7t

635
13

12 t

70 u
}
13

> eval( x, s2 );

527
13

28 u
13

7t

> x(1,1);

x( 1, 1 )
> x := unapply(%, u, t);

# % = eval(x,s2)
x := ( u, t ) x( 1, 1 )

> x(1,1);
Error, (in x) too many levels of recursion

Lnh RootOf
i khi, Maple tr v nghim ca cc phng trnh di dng lnh RootOf. iu ny thc s
hu ch nu trng i s ca ta ang lm vic khc vi trng s phc. Cc index i theo trong
lnh RootOf chnh l th t cc nghim. Nu mun ly gi tr tng minh ca cc nghim ta c
th s dng hm evalf.
V d
> solve({x^5 - 2*x + 3 = 0},{x});
{ x RootOf( _Z5 2 _Z 3, index 1 ) }, { x RootOf( _Z5 2 _Z 3, index 2 ) },
{x

RootOf( _Z5

2 _Z

3, index

3 ) }, { x

{x

2 _Z

3, index

5)}

RootOf( _Z

RootOf( _Z5

2 _Z

3, index

4 ) },

> evalf(%);
{ x 0.9585321812 0.4984277790 I }, { x -0.2467292569 1.320816347 I },
{ x -1.423605849 }, { x -0.2467292569 1.320816347 I },
{ x 0.9585321812 0.4984277790 I }

Lnh fsolve
- Lnh ny tng ng vi lnh solve, nhng nghim thu c khi gii phng trnh bng
lnh ny l mt dng nghim xp x di dng s.
V d
> fsolve({cos(x)-x = 0}, {x});
{ x 0.7390851332 }
> poly :=3*x^4 - 16*x^3 - 3*x^2 + 13*x + 16;
poly := 3 x4 16 x3 3 x2 13 x 16
> fsolve({poly},{x});
{x

1.324717957 }, { x 5.333333333 }

> fsolve({sin(x)=0}, {x});

{ x 0. }

> fsolve({sin(x)=0}, {x}, avoid={x=0});


{ x -3.141592654 }
> fsolve({poly}, {x}, complex);
{ x -0.6623589786 0.5622795121 I }, { x -0.6623589786
{ x 1.324717957 }, { x 5.333333333 }

0.5622795121 I },

> fsolve({cos(x)=0}, {x}, Pi..2*Pi);


{ x 4.712388980 }
>

Lnh dsolve
Maple c th gii nhiu phng trnh vi phn bnh thng (ODEs: ordinary differential
equations) bng lnh dsolve
V d 1
> ode1 := {diff(y(t),t,t) + 5*diff(y(t),t) + 6*y(t) = 0};
d2
d
ode1 := { 2 y( t )
5
y( t )
6 y( t ) 0 }
dt
dt
> ic := {y(0)=0, D(y)(0)=1};
ic := { y( 0 )

0, D( y )( 0 ) 1 }

> soln := dsolve(ode1 union ic, {y(t)});


( 2 t)
(
soln := y( t ) e
e

3 t)

ly gi tr ca nghim ti cc im khc nhau ta c th dng lnh unapply nh bit. Trc


ht ta s dng lnh eval trch ra biu thc t tp hp nghim
> eval( y(t), soln );
( 2 t)
( 3 t)
e
e
> y1:= unapply(%, t );

y1 := t

( 2 t)

( 3 t)

> y1(a);

( 2 a)

( 3 a)

V d 2
> pt := { diff(y(x),x,x)=z(x), diff(z(x),x,x)=y(x) };
d2
d2
pt := { 2 y( x ) z( x ), 2 z( x ) y( x ) }
dx
dx
> nghiem := dsolve(pt, {z(x),y(x)});
( x)
nghiem := { z( x ) _C1 e x _C2 e
_C3 sin( x ) _C4 cos( x ),
y( x )

_C1 e x

_C2 e

( x)

_C3 sin( x )

_C4 cos( x ) }

> y := unapply(eval(y(x), nghiem), x );


( x)
y := x _C1 e x _C2 e
_C3 sin( x ) _C4 cos( x )

> y(1);

_C1 e

_C2 e

( -1 )

_C3 sin( 1 )

_C4 cos( 1 )

> y:='y';

y := y

Mt s lnh khc
Lnh isolve: tm nghim nguyn ca cc phng trnh
> isolve({3*x-4*y=7});

{ y 2 3 _Z1, x 5 4 _Z1 }
Lnh msolve: gii phng trnh theo modulo m
> msolve({3*x-4*y=1,7*x+y=2},17);
{ y 6, x

14 }

> msolve({2^n=3},19);

{ n 13 18 _Z2 }
> solve({3*x-4*y=1,7*x+y=2});

{x

9
,y
31

-1
}
31

> about(_Z1);
_Z1:
nothing known about this object

Lnh rsolve: gii cc phng trnh truy hi


> rsolve({f(n)=f(n-1)+f(n-2),f(0)=1,f(1)=1},{f(n)});
Error, invalid input: f uses a 2nd argument, y, which is missing

1.4. o hm
V d 1
> y := x^4+x^3+x^2+x+1;

y := x4

x3

d 4
(x
dx

x3

x2

> Diff(y,x);

x2

1)

> diff(y,x);

4 x3

3 x2

2x

> Diff(y,x,x,x);
d3 4
(x
dx 3

x3

x2

1)

> diff(y,x$3);

24 x 6
> unassign('y');

V d 2
> z:=x*exp(x/y)+sin(y/x);
x
y

z := x e

sin

y
x

> diff(z,x,y);
2xe
y2

x
y

x e
y3

x
y

sin

y
y
x
x3

cos

y
x

x2

> diff(z,x$2);
2e
y

x
y

xe
y2

x
y

sin

y 2
y
x
x4

y
y
x

2 cos
x3

> diff(z,y,y);
2

2x e
y3

x
y

x e
y4

x
y

sin

y
x

x2

V d 3
> f := (x) -> sqrt(2*Pi)*x^(x+1/2)*exp(-x);
( x 1/2 ) ( x )
f := x
2 x
e
> simplify(diff(f(x),x));
1
2
2

(x

1/2 )

( x)

( 2 ln( x ) x

> evalf(50!);

0.3041409320 1065
> evalf(f(50));

0.3036344593 1065
> seq(evalf(n!/f(n)),n=2..22);

1)

1.042207121, 1.028064518, 1.021008303, 1.016783985, 1.013972848, 1.011967757,


1.010465651, 1.009298426, 1.008365359, 1.007602428, 1.006966997,
1.006429575, 1.005969115, 1.005570189, 1.005221239, 1.004913427,
1.004639885, 1.004395190, 1.004175011, 1.003975836, 1.003794800

1.5. Tnh phn


> with(student):

V d 1: Tm nguyn hm, tnh tch phn hm mt bin


> Int(x^4*exp(-x),x);
x4 e

( x)

> simplify(int(x^4*exp(-x),x));
( 24 24 x 12 x2

dx

4 x3

x4 ) e

( x)

> Int(x/(x^4-1),x);
x
x

dx

> int(x/(x^4-1),x);

1
ln( x
4

1
ln( x
4

1)

1)

1
ln( x2
4

1)

> Int(exp(-x^2),x=-infinity..infinity); #Tich phan suy rong


e

2
( x )

dx

> value(%);
>
>

V d 2: Tnh tch phn 2 lp, 3 lp


> Doubleint(sin(x*y),x=0..1,y=1..2);
2

sin( x y ) dx dy
1

> value(%);

Ci( 2 ) ln( 2 ) Ci( 1 )

> evalf(%);

0.6075702747
> ?Doubleint
> restart:with(student):
> Tripleint(sin(x*y*z),x=0..1,y=0..1,z=0..1);
1

sin( x y z ) dx dy dz
0

> value(%);
1

ln ( z ) Ci( z )
dz
z
0

> evalf(%);

0.1224340288

V d 3: Tnh tch phn lp


> Int(Int(y,y=0..1/((sin(x))^3+(cos(x))^3)),x=0..2);
1
2

sin( x )

cos( x )

y dy dx
0

> evalf(%);

1.417868442
> Int(sin(x)*Int(y^2,y=0..sin(x)-cos(x)),x=Pi/4..3*Pi/4);
3
4
sin( x )

cos( x )

y 2 dy dx

sin( x )
0
4

> value(%);

1
6

2. S dng Maple trong i s tuyn tnh


i s tuyn tnh l mt mn hc quan trng trong chng trnh o to m sinh vin cc ngnh
Ton, Vt l,... phi hc trong nm th nht. Maple cng xy dng mt gi cng c rt hon

thin gii quyt cc vn trong STT, l LinearAlgebra hoc linalg. Trc khi
lm vic vi STT ta nn gi gi cng c with(LinearAlgebra) hoc with(linalg);

Ma trn, vect v cc php tnh c bn


nh ngha Ma trn v Vect
C rt nhiu cch nh ngha ma trn, vic chn la cch no l ty vo hon cnh v ty vo
tng ngi.
V d
> A:=Matrix([[1,2],[3,4]]);
1 2
A :=
3 4
> B:=matrix(2,2,[1,2,3,4]);
B :=

1
3

5
5

5
5

2
4

> Matrix(1..2,1..3,5);
5
5

> array([[1,2],[3,4]]);
1
3

2
4

tham chiu n cc phn t ca ma trn ta dng cng thc A[row,column], v d:


> A[1,2];
2
Nu mun hin th mt ma trn khng cp 2x2 ta lm nh sau:
V d
> C:=Matrix(2,2);
0 0
C :=
0 0
> B:=Matrix(1..2,1..2);
B :=

0
0

0
0

Mt khi ma trn nh nh ngha ta c th gn gi tr cho tng phn t ca n


V d
> B[1,1]:=2;B[1,2]:=3;B[2,1]:=7;B[2,2]:=4;
B1, 1 := 2
B1, 2 := 3

B2, 1 := 7
B2, 2 := 4

> B;
2
7

3
4

C mt cch khc nhp mt ma trn vo m Maple xy dng sn m ta nn l: Trn


thanh menu nhp chn View\ Palettes\ Matrix Palettes. Sau hng lnh sau s xut hin v
ta ch vic nhp vo cc phn t ca ma trn.
> Matrix([[%?, %?, %?], [%?, %?, %?], [%?, %?, %?]]);
? ? ?
? ? ?
? ? ?
Nu mun tm hiu thm v ma trn hy dng tr gip ?Matrix.
nh ngha mt vect hng hay vect ct ta dng lnh Vector nh sau:
V d
Theo mc nh lun to vect ct
> b:=Vector([5,6]);
5
b :=
6
> b:=Vector[row]([5,6]);

b := [ 5, 6 ]
Nu mun cho ra mt vect t cc hng hoc cc ct ca mt ma trn c ta dng lnh
Column v Row nh sau
V d
> c:=Column(A,2);
2
c :=
4
> c:=Row(A,1);
c := [ 1, 2 ]

Ngoi ra cn c mt c php nh ngha ma trn v vect m ta cng nn nhc n l: <...>


> s:=<1,2,3>;

s :=

1
2
3

V v ma trn l tp hp cc ma trn ct nn c nh ngha:


> R:=<<1,2,3>|<4,5,6>|<7,8,10>>;
1 4
7
R := 2 5
8
3 6 10
i khi ma trn, vect khng ch c cc phn t l s m cn l cc cng thc hoc cc hng nn
ta lu v d sau
V d
> d:=Matrix([[x11,x12],[x21,x22]]);
x11 x12
d :=
x21 x22
>
> e:=Matrix([[x^2*y,y*x],[sin(x),1/x]]);
x2 y y x
e :=
1
sin( x )
x
Lu s khc nhau gia eval v evalf
> eval(e,{x=1,y=2});
2
sin( 1 )

2
1

> evalf(eval(e,{x=1,y=2}));
2.
0.8414709848

2.
1.

Cc php ton c bn trn ma trn


> restart:with(LinearAlgebra):
Php cng, tr
C nhiu cch cng 2 ma trn, thng thng ta dng lnh Add, xt cc v d sau:
> B:=Matrix([[1,2,3],[4,5,6],[7,8,9]]);
1 2 3
B := 4 5 6
7 8 9
> C:=Matrix([[3,2,1],[5,6,4],[9,7,8]]);
3 2 1
C := 5 6 4
9 7 8

> B+C;
4
9
16

4
11
15

4
10
17

> E:=Add(B,C);
4
E := 9
16

4
11
15

4
10
17

Php tr c thc hin bng cch ly i ca mt ma trn


> E:=Add(B,-C);
-2 0 2
E := -1 -1 2
-2 1 1
Ch rng khi thc hin php cng, tr th ma trn phi cng kch c (y l mt li rt hay gp
khi thc hnh).
> F:=Matrix([[5,7],[1,3]]);
5 7
F :=
1 3
> Add(E,F);
Error, (in LinearAlgebra:-MatrixAdd) matrix dimensions don't match: 3 x 3 vs 2
x 2

Php nhn
nhn cc ma trn hoc cc vect vi nhau ta dng lnh Multiply, xt cc v d sau:
> G:=Multiply(B,C);
40
35
33
G := 91
80
72
142 125 111
Lnh ny cng c th thc hin vic nhn mt ma trn vi mt vec t
> b:=<5,6,7>;
5
b := 6
7
> Multiply(B,b);
38
92
146

Ngoi ra, ta c th nhn ma trn v vect vi mt v hng bng php nhn * thng thng

> 3*B;
3
12
21

6
15
24

9
18
27

> 5*b;
25
30
35

Tm ma trn nghch o, nh thc v hng ca ma trn


Trong phn ny ch gii thiu thm mt s lnh thng gp khi lm vic vi ma trn v vect.
l tt cc bi thc hnh nn c thm cc lnh trong gi LinearAlgebra. Xt cc v d sau:
> restart:with(LinearAlgebra):
> B:=Matrix([[1,2,3],[4,5,6],[7,8,9]]);
1 2 3
B := 4 5 6
7 8 9
> C:=Matrix([[3,2,1],[5,6,4],[9,7,8]]);
3 2 1
C := 5 6 4
9 7 8
MatrixInverse: Tm ma trn nghch o ca mt ma trn cho trc
> MatrixInverse(C);
20
-3
2
33
11
33
-4
5
-7
33
11
33
-19
-1
8
33
11
33
Kim tra xem th lnh va thc hin c ng khng
> Multiply(C , MatrixInverse(C));
1 0 0
0 1 0
0 0 1
Determinant: Tnh nh thc ca ma trn
> Determinant(B);Determinant(C);

33

Transpose: Tm chuyn v ca ma trn


> Transpose(C);
3
2
1

5
6
4

9
7
8

> E:=Matrix([[1,2,3]]);
E := [1

3]

> Transpose(E);
1
2
3

Trace: Tm vt ca mt ma trn vung (tng cc phn t trn ng cho chnh)


> C;
3 2 1
5 6 4
9 7 8
> Trace(C);

17
Rank: Tm hng ca mt ma trn
> with(LinearAlgebra):
A := ScalarMatrix(n,3);
n
A := 0
0

0
n
0

0
0
n

> Rank(A);

3
Tch v hng v gc gia 2 vect
tnh tch v hng ca 2 vct ta dng lnh DotProduct, tnh gc gia 2 vect ta dng lnh
VectorAngle. Xt cc v d sau:
> restart:with(LinearAlgebra):
> v1:=<1|2|3>;v2:=<4|5|6>;
v1 := [ 1, 2, 3 ]

v2 := [ 4, 5, 6 ]
> DotProduct(v1,v2);

32

> VectorAngle(v1,v2);
arccos

16 14 77
539

> evalf(VectorAngle(v1,v2));

0.2257261290

Gii h phng trnh tuyn tnh


Ta bit rng mt h phng trnh tuyn tnh c th vit di dng: A*x=b, vi A l mt mxn ma
trn v b l vect ct gm m phn t. Trong gi th vin LinearAlgebra ca Maple c lnh
LinearSolve dng gii cc h phng trnh ny. Ta xt v d sau:

V d
> restart;with(LinearAlgebra):
> A:=Matrix([[1,1,-3/2],[0,-1,1],[1,-2-1/4,1]]);
-3
1
1
2
A := 0 -1
1
-9
1
1
4
> b:=Vector([0,6,0]);
b :=

0
6
0

> LinearSolve(A,b);
19
20
26

> ?LinearSolve
Trong v d th 2 ny ta s gp lnh RandomMatrix dng to ma trn vi cc phn t ngu
nhin, v gii h phng trnh tuyn tnh theo 2 cch.

V d
> Ab := RandomMatrix(3,4, outputoptions=[datatype=float]);
-70. -94. -53. 40.
Ab := 13. -7. 21. 97.
-58. 12. -25. 43.

> LinearSolve(Ab);
-3.83651127878185338
-1.27278664872979652
6.56976857538359660

> {op(GenerateEquations(Ab, [x,y,z]))};


{ 70. x 94. y 53. z 40., 13. x 7. y 21. z 97., 58. x
> fsolve(%);
{ y -1.272786649, z

12. y 25. z 43. }

6.569768576, x -3.836511279 }

> subs(%, <x,y,z>);


-3.836511279
-1.272786649
6.569768576

Mun tm hiu thm v lnh ny hy xem tr gip ?LinearSolve;

3. Cc cu trc d liu c bn khc trn Maple


Dy cc biu thc (Expression sequence)
V d
> 1,2,3,4;

1, 2, 3, 4
> x,y,z,u;

x, y, z, u
Lu rng cu trc ny khng phi l mt danh sch hay mt tp hp. y l mt cu trc da
liu ri rc trong Maple c nhng tnh cht ring:
- Dy cc biu thc l mt cu trc biu din c th t cc thnh phn v cho php cc thnh
phn trong dy trng nhau. Th t khi ta nhp vo cng chnh l th t ca cc thnh phn.
- Ta c th thc hin php ton ghp (||) trn cu trc ny.
V d
> a||b;
0
a || 6
0
> S:=1,2,3,4;

S := 1, 2, 3, 4
> a||S;

a1, a2, a3, a4

- Ngoi ra ta cng c th s dng cu trc ny thc hin php gn chung cho nhiu thnh
phn.
V d
> f,g,h:=2,-1,5;
f, g, h := 2, -1, 5
> g;

-1

Danh sch (List)


Ta c th to ra mt danh sch trong Maple bng cch gom cc i tng (c th ging nhau
hoc khc nhau, phn bit bi du phy) trong cp du ngoc vung. Cc i tng trong danh
sch c th l cc phn t phn bit, cng c th l cc danh sch khc.
V d
> data_list:=[1,2,3,4,5];
data_list := [ 1, 2, 3, 4, 5 ]
> poly:=[x^2+1,2*x-3,3-x];
poly := [ x2

1, 2 x

3, 3

x]

> dsten:=[Tom,Jerry,Mickey];
dsten := [ Tom, Jerry, Mickey]
> b:='b';
b := b

> ds_cua_ds:=[[a,b],[1,2,3],[x,y,z]];
ds_cua_ds := [ [ a, b ], [ 1, 2, 3 ], [ x, y, z ] ]
Lu rng Maple bo ton th t ca cc phn t trong danh sch ging vi th t c nhp
vo, do ta c th truy cp trc tip vo cc phn t thng qua th t ca chng.
V d
> chucai:=[a,b,c,d,a];
chucai := [ a, b, c, d, a ]
> chucai[3];

c
Ta c th kim tra mt cu trc c nhp vo c phi l danh sch hay khng bng lnh type.
V d
> type(poly,list);
false
> type(ds_cua_ds,list);
true

> type(ds_cua_ds,listlist);

false
y listlist cng l mt cu trc tm gi l danh sch ca danh sch, nhng ch cc danh sch
thnh phn trong listlist phi c cng s phn t.
> L:=[[1,2],[a,b],[x,y]];
0
L := [ 1, 2 ], a, 6 , [ x, y ]
0
> type(L,listlist);
true

>
Ta c th truy nhp trc tip vo cc thnh phn ca danh sch thng qua th t cc phn t
bng cc cch sau:
V d
> L:=[1,3,5,a,b];
L := [ 1, 3, 5, a, b ]
> L[4];

a
> op(4,L);

a
> nops(L); #Cho ra so phan tu trong danh sach
5
> op(L); #tra ve day cac phan tu cua danh sach
1, 3, 5, a, b

Tp hp (Set)
- Ging nh k hiu ta vn thng din t khi lm ton, tp hp c to thnh khi ta gom cc
i tng (cch nhau bi du phy) vo trong cp du ngoc{}.
- Cc phn t trong tp hp phi phn bit v cu trc ny khng tnh n th t ca cc phn t.
Do , nu ta nhp vo tp{a,b,c} hay{b,c, a} l nh nhau.
- Tuy nhin, Maple phn bit gia s nguyn v s thc (ngha l s 2 v 2.0 l khc nhau) nn
tp hp nh sau vn c chp nhn: {1,2,2.0}
V d
> data_set:={1,-1,2,7};
data_set := { -1, 1, 2, 7 }
> var:={x,y,z};

var := { y, x, z }
> {a,b,c},{b,c,a},{a,a,b,c,a};
{ a, c, b }, { a, c, b }, { a, c, b }
> {1,2,3,1,2.0};

{ 1, 2, 3, 2.0 }
- Trn tp hp ta c th thc hin cc php ton: union, intersect, minus hoc nhiu php ton
khc. Tp rng c k hiu l{}.
V d
> {a,b,c} union {c,d,e};
{ e, a, c, b, d }
> {1,2,3} intersect {0,1,a,2};
{ 1, 2 }

> nops(%);

2
* Mt lnh rt thng c s dng trn tp hp l lnh map lnh ny cho php p dng
mt hm ng thi ln tt c cc thnh phn ca tp hp.
V d
> number:={0,Pi/2,Pi/3,Pi};

number := { 0,

, , }
2 3

> map(g,number);

{ g( 0 ), g

,g

, g( ) }

> map(sin,number);
{ 0, 1,

3
}
2

Mt s php ton khc thc hin trn tp hp v danh sch


> ten:=[Tom,Jerry,Donal,Mickey];
ten := [ Tom, Jerry, Donal, Mickey]
> member(Tom,ten);
true

> evalb(Jerry in ten);


true

> tap_rong:={};

tap_rong := { }
> ds_rong:=[];

ds_rong := [ ]
> nops(ten);

4
> op(3,ten);

Donal

Mng (Array)
- L mt kiu cu trc d liu m rng ca cu trc danh sch, trong cc ch s ca mt mng
bt k u l cc s nguyn v phm vi ca cc ch s mng phi c nh r khi khai bo
mng. Cc thnh phn trong mng i lin vi ch s ca n. Hn na, ta c th nh ngha li cc
thnh phn mt cch ring bit m khng cn phi nh ngha li ton b mng.
V d
> A:=array(1..2,1..2,[]);
A := array( 1 .. 2, 1 .. 2, [ ] )
> A[1,1]:=1: A[1,2]:=4: A[2,1]:=2: A[2,2]:=3:
> A;
A
> print(A);
1
2

4
3

> B:=array(1..3,[a,b,c]);

B := [ a, b, c ]
- Ngoi ra, nu ta mun thay th cc thnh phn ca mng bi cc gi tr hoc biu thc khc th
c th dng lnh subs (vit tt t ch substitution) nh sau:
V d
> bt:=z^3+2;
bt := z3 2
> subs({z=x+y},bt);

(x

y )3

> a:=array(1..2,[5,3]);

a := [ 5, 3 ]
> subs({5=9},a);

a
> a1:=subs({5=9},evalm(a));

a1 := [ 9, 3 ]

Bng (Table)
- L mt cu trc d liu m rng ca cu trc mng. S khc nhau gia bng v mng l ch s
ca bng c dng bt k ch khng ch gii hn s nguyn nh mng. Cu trc chung ca mt
bng l: table( F, L);
trong F l danh sch cc ch s, cn L l danh sch cc phn t. Ta c th hnh dung mt
bng nh l mt nh x a tr t tp cc ch s F n tp cc phn t L.

V d
> T:=table([[1,2],[a,b],[c,d,e]]);
T[2];
T := table([1 [ 1, 2 ], 2 [ a, b ], 3

[ c, d, e ]])

[ a, b ]

> bang:=table([one=vang,two=xanh,three=den]);
bang := table([two xanh, one vang, three

den])

> bang[two];

xanh
> guitar[day1]:=mi,fa,sol;
guitarday1 := mi , fa, sol
> guitar[day2]:=si,ddo,re;
guitar day2 := si, ddo, re
> guitar[day3]:=sol,la;
guitarday3 := sol, la

> print(guitar);
table([day1 ( mi, fa, sol ), day3

( sol, la ), day2 ( si, ddo, re )])

> indices(guitar); #in ra cac chi muc trong bang


[ day1 ], [ day3 ], [ day2 ]
> entries(guitar); #in ra cac thanh phan cua bang
[ mi, fa, sol ], [ sol, la ], [ si, ddo, re ]
> guitar[day2]:='guitar[day2]'; #xoa phan tu day2 ra khoi bang guitar
guitar day2 := guitar day2
> print(guitar);

table([day1 ( mi, fa, sol ), day3 ( sol, la )])

Chui (String)
- Ging nh cc ngn ng lp trnh khc, chui trong Maple l mt tp hp cc k t nm gia
hai du nhy kp "".
- Trn chui, ta c th truy xut bt c thnh phn no ca n da vo v tr ca thnh phn
trong chui bng cch tng t nh bng hoc danh sch; ta c th ghp hai chui li bng
php ton || hoc cat; v c th xem di ca chui bng lnh length.
V d
> "This is a string";
"This is a string"
> chuoi:="Later than Never";
chuoi := "Later than Never"

> chuoi[7..10];

"than"
> new:=cat("I have to learn. ",chuoi);
new := "I have to learn. Later than Never"
> length(new);

33

4. Cch t chc trong Maple


Th vin ca Maple c chia lm 2 nhm: nhm th vin chnh v nhm cc gi lnh
(packages). Th vin chnh ca Maple cha cc lnh thng s dng nht trn Maple, cn cc
lnh su hn i vi mi i tng c th th nm cc gi lnh. Mi gi lnh cha mt nhm
cc lnh cho cc tnh ton lin quan vi nhau (V d gi LinearAlgebra cha cc lnh thao tc
trn ma trn). Ta c th s dng cc lnh trong cc gi lnh theo mt trong nhng cch sau:
1. S dng tn y ca gi lnh v tn ca lnh:
package[cmd]( ... )
Nu gi lnh cn c gi lnh con th s dng:
package[subpackage][cmd]( ... )
2. Gi gi lnh vi with sau s dng tn ca cc lnh trong gi:

with(package)

3. Gi gi lnh v lnh s dng:


with(package[subpackage], cmd)
V d
> with(Student[Calculus1]);
[ AntiderivativePlot, AntiderivativeTutor, ApproximateInt, ApproximateIntTutor,
ArcLength, ArcLengthTutor, Asymptotes, Clear, CriticalPoints, CurveAnalysisTutor,
DerivativePlot, DerivativeTutor, DiffTutor, ExtremePoints, FunctionAverage,
FunctionAverageTutor, FunctionChart, FunctionPlot, GetMessage,
GetNumProblems, GetProblem, Hint, InflectionPoints, IntTutor, Integrand,
InversePlot, InverseTutor, LimitTutor, MeanValueTheorem,
MeanValueTheoremTutor, NewtonQuotient, NewtonsMethod, NewtonsMethodTutor,
PointInterpolation, RiemannSum, RollesTheorem, Roots, Rule, Show,
ShowIncomplete, ShowSteps, Summand, SurfaceOfRevolution,
SurfaceOfRevolutionTutor, Tangent, TangentSecantTutor, TangentTutor,
TaylorApproximation, TaylorApproximationTutor, Understand, Undo,
VolumeOfRevolution, VolumeOfRevolutionTutor, WhatProblem ]
> y=Tangent(sin(x),x=0); # Tim tiep tuyen cua sin(x) tai x=0
y x
> plot(sin(x),x=-Pi..Pi);

>
>
Sau y gii thiu mt s gi lnh thng hay s dng trn Maple
1. CodeGeneration: cha cc hm c th dch cc m trong Maple thnh nhng ngn ng
lp trnh khc nh: C, Fortran, Java, Visual Basic.
2. combinat: cc hm t hp, bao gm cc lnh cho vic tnh ton cc hon v v t hp
ca cc danh sch...
3. combstruct: gm cc lnh cho vic to ra v tnh ton cc cu trc t hp, thng s
dng xc nh cc phng trnh hm sinh ra trong tnh ton.
4. DEtools: cc cng c thao tc trn cc phng trnh vi phn
5. Domains: cha cc lnh dng to ra tp xc nh ca cc tnh ton; h tr tnh ton
vi a thc, ma trn, chui trn cc vnh s, vnh a thc, vnh cc ma trn.
6. Maplets: gm cc cu lnh cho vic to ra cc giao din nh ca s tnh ton, hp thoi
hoc cc giao din khc cho cc ng dng.
7. numtheory: gm cc cu lnh lm vi l thuyt s.
8. plots: cc lnh lin quan n v th ca hm s.

9. plottools: gm cc lnh lin quan n dng hnh hc ca cc vt th.


10. Student: cha cc gi lnh con cho vic tnh ton c bn. Gm 3 gi lnh con:
Precalculus, Calculus1, LinearAlgebra.

Xt mt s v d sau:
V d 1
tm o hm ca hm s ta c th s dng Maplet DiffTutor trong gi Student[Calculus1]

> with(Student[Calculus1]);
DiffTutor();
[ AntiderivativePlot, AntiderivativeTutor, ApproximateInt, ApproximateIntTutor,
ArcLength, ArcLengthTutor, Asymptotes, Clear, CriticalPoints, CurveAnalysisTutor,
DerivativePlot, DerivativeTutor, DiffTutor, ExtremePoints, FunctionAverage,
FunctionAverageTutor, FunctionChart, FunctionPlot, GetMessage,
GetNumProblems, GetProblem, Hint, InflectionPoints, IntTutor, Integrand,
InversePlot, InverseTutor, LimitTutor, MeanValueTheorem,
MeanValueTheoremTutor, NewtonQuotient, NewtonsMethod, NewtonsMethodTutor,
PointInterpolation, RiemannSum, RollesTheorem, Roots, Rule, Show,
ShowIncomplete, ShowSteps, Summand, SurfaceOfRevolution,
SurfaceOfRevolutionTutor, Tangent, TangentSecantTutor, TangentTutor,
TaylorApproximation, TaylorApproximationTutor, Understand, Undo,
VolumeOfRevolution, VolumeOfRevolutionTutor, WhatProblem ]
Initializing Java runtime environment.

d
( x sin( x ) )
dx

sin( x )

x cos( x )

d
( x cos( x ) )
dx

cos( x )

x sin( x )

cos( x )

x sin( x )

> DiffTutor(x*cos(x));

> DiffTutor(x*cos(x),x);
d
( x cos( x ) )
dx
> restart;
tm hiu cch tnh tch phn ta dng lnh Rule

> Int(x*cos(x) + x, x=0..Pi);


x cos( x )

x dx

> Rule[sum](%);
Rulesum

x cos( x )
0

> Rule[power](%);

x dx

Rulepower Rulesum

x cos( x )

x dx

> Hint(%); # xac dinh buoc giai tiep theo


Hint Rulepower Rulesum

x cos( x )

x dx

> Rule[%](%%);
Rule
Hint Rule

Rulepower Rulesum
power

Rule

sum

x cos( x )

x cos( x )

x dx

x dx

> Rule[sin](%);
Rulesin Rule

Rulepower Rulesum

Hint Rule

power

Rule

sum

x cos( x )

x cos( x )

x dx

x dx

x cos( x )

x dx

>
Tm hiu cch tnh gii hn

> Understand(Limit, constant, `c*`, power, sum);


Limit [ constant, constantmultiple, power, sum ]
cu lnh trn nhm ch ra vic s dng cc quy lut tnh gii hn m khng p dng trc tip
cho kt qu.
> Limit((1 + 1/x)^x, x=infinity);
x
1
lim 1
x
x
> Hint(%);
x

1
x

rewrite, 1

x ln 1

1
x

> Rule[%](%%);
lim

1
x

x ln 1

1
x

x ln 1

1
x

lim e
x

> Hint(%);

[ exp ]
> Rule[%](%%);
lim
x

1
x

lim

> Hint(%);

1
x

lhopital, ln 1
> Rule[%](%%);
lim

1
x

lim

> restart;
>
V d 2
* Xc nh c s ca khng gian vect sinh bi cc vect: [1;-1; 0; 1], [5;-2; 3;-1], v [6;-3; 3;
0]. Biu din vect [1,2,3,-5] theo c s
> with(LinearAlgebra):
> v1:=<1|-1|0|1>:
v2:=<5|-2|3|-1>:
v3:=<6|-3|3|0>:
> vector_space:=<v1,v2,v3>;
1 -1 0 1
vector_space := 5 -2 3 -1
6 -3 3 0
> LinearSolve( Transpose(vector_space), <0,0,0,0> );
_t3
_t3
_t3

kt qu trn ch ra rng cc vect trn khng c lp tuyn tnh v vy chng khng th l c


s
> b:=RowSpace(vector_space);
b := [ [ 1, 0, 1, -1 ], [ 0, 1, 1, -2 ] ]
> b1:=b[1]; b2:=b[2];

b1 := [ 1, 0, 1, -1 ]
b2 := [ 0, 1, 1, -2 ]
> basis:=<b1,b2>;
basis :=

1
0

0
1

1
1

-1
-2

> LinearSolve( Transpose(basis), <1|2|3|-5> );


Error, (in LinearAlgebra:-LA_Main:-LinearSolve) number of rows of left hand side
Matrix, 4, does not match number of rows of right hand, 1

>

V d 3
By gi ta s lm mt s tnh ton trn gi stats (gi thng k). Trong gi ny cha cc gi lnh
con:
> with(stats);
[ anova, describe, fit, importdata, random, statevalf, statplots, transform ]
Gi stats lm vic vi d liu dng danh sch thng k (c th to ra bi cu trc danh sch ca
Maple).
> marks :=[64,93,75,81,45,68,72,82,76,73];
marks := [ 64, 93, 75, 81, 45, 68, 72, 82, 76, 73 ]
> readings := [ 0.75, 0.75, .003, 1.01, .9125,
.04, .83, 1.01, .874, .002 ];
readings := [ 0.75, 0.75, 0.003, 1.01, 0.9125, 0.04, 0.83, 1.01, 0.874, 0.002 ]
> describe[mean](marks);

729
10
> describe[range](marks);

45 .. 93
> describe[range](readings);

0.002 .. 1.01
> describe[standarddeviation](readings);
0.4038751074
> random_data:=[random[normald](50)];
random_data := [ 1.275676034, 0.4761860895 , -2.620054215, 0.8547207946 ,
-1.089001803, 0.7165427609 , -0.02996436194, 1.330855643 , -1.296345120,
-0.4703304005, -0.7122630822, -0.08717900722, 1.282253011, -1.683720684,
0.3265473243 , 0.08179818206 , 0.2127564698 , -0.7279468705, 0.6855773713 ,
-0.3760280547, -0.8074455431, 0.5638425492 , 0.7668276240 , -0.9578304704,
0.09625284223 , -0.5899328336, 0.8199273969 , 1.522884873, -0.2965618595,
-0.7531006388, 0.3151206337 , -0.6711662977, -0.3957955372, 0.3570600824 ,
0.004561604546 , -0.2594005341, 0.8186971245 , -0.7093245232, -0.1522233390,
-0.01405914095, -0.6157994795, -0.7439751083, 0.7842556864 , 2.454999901,
0.8338628854 , -0.9492334297, -0.7742757515, 0.1717256675 , -1.535635792,
1.087459487 ]
>
>
>

Вам также может понравиться