You are on page 1of 76

Maple

20021


I
I


3 14 1 3
Maple Maple
Maple 6 4 9
Maple 6 Maple
6 10 14
Maple 6 Maple 6


Maple 6 Maple 6 Maple 6

Maple Maple

Maple 6

1 Maple 6 2

1.1 Maple 3
1.2 Maple 5
1.3 Maple 5
1.3.1 7
1.3.2 9
1.3.3 10
1.3.4 11
1.3.5 13
1.3.6 14
1.3.7 17
1.4 Maple 6 18
1.5 18

2 19

2.1 20
2.2 Maple 6 20
2.3 Maple 6 23
2.2.1 23
2.2.2 26
2.4 27

3 Maple 6 28

3.1 File 29
3.1.1 29
3.1.2 30
3.1.3 31
3.2 Edit 33
3.2.1 34
3.2.2 35
3.2.3 36
3.3 View 37
3.3.1 37
3.3.2 41
3.3.3 41
3.3.4 42
3.3.5 43
3.4 Insert 44
II

3.4.1 44
3.4.2 45
3.5 Format 46
3.5.1 46
3.5.2 47
3.5.3 48
3.6 Spreadsheet 49
3.6.1 50
3.6.2 50
3.6.3 51
3.7 Option 52
3.7.1 52
3.7.2 54
3.8 Window 55
3.9 Help 57
3.10 60

4 Maple 62

4.1 Maple 63
4.2 64
4.3 67
4.4 69
4.5 71
4.6 73
4.7 74

5 Maple 75

5.1 76
5.1.1 76
5.1.2 79
5.2 82
5.3 84
5.4 86
5.4.1 86
5.4.2 88
5.5 89
5.6 90
5.7 92

6 Maple 94

6.1 Maple 94
III

6.1.1 := 95
6.1.2 96
6.1.3 unapply 98
6.1.4 proc 99
6.2 Maple 100
6.2.1 100
6.2.2 102
6.2.3 105
6.2.4 106
6.3 107

7 108

7.1 109
7.1.1 101
7.1.2 113
7.1.3 114
7.2 116
7.2.1 simplify 116
7.2.2 expand 118
7.2.3 combine 119
7.2.4 normal 120
7.2.5 collect 121
7.2.6 sort 123
7.2.7 convert 125
7.2.8 factor 126
7.3 127
7.4 129
7.4.1 129
7.4.2 131
7.4.3 132
7.5 135
7.6 138
7.7 140
7.7.1 140
7.7.2 141
7.8 143

8 145

8.1 146
8.2 147
8.3 155
8.4 158
8.5 165
8.6 173
8.7 176
IV

8.8 179
8.9 183
8.10 186
8.11 188
8.12 190
8.13 202
8.14 211
8.15 214

9 216

9.1 216
9.2 220
9.3 221
9.4 226
9.5 229
9.6 233
9.7 237
9.8 243

10 Maple 245

10.1 246
10.1.1 248
10.1.2 250
10.1.3 252
10.1.4 256
10.1.5 257
10.2 258
10.2.1 260
10.2.2 261
10.2.3 263
10.2.4 264
10.2.5 265
10.3 266
10.3.1 266
10.3.2 267
10.3.3 268
10.4 269
10.4.1 269
10.4.2 269
10.4.3 270
10.4.4 271
V

10.4.5 272
10.4.6 273
10.4.7 274
10.4.8 274
10.5 plottools 275
10.6 281
10.6.1 281
10.6.2 282
10.7 284
10.8 286

11 288

11.1 289
11.2 289
11.2.1 289
11.2.2 290
11.3 292
11.3.1 293
11.3.2 293
11.3.3 296
11.4 297
11.4.1 298
11.4.2 299
11.4.3 linsolve 299
11.5 300

12 301

12.1 302
12.2 305
12.2.1 305
12.2.2 306
12.2.3 307
12.2.4 307
12.3 309
12.3.1 309
12.3.2 310
12.3.3 310
12.4 312
12.5 314

13 315

13.1 316
13.2 317
13.3 318
13.4 321
VI

13.5 321
13.5.1 proc 322
13.5.2 RETURN 327
13.5.3 ERROR 328
13.6 329

14 330

14.1 Maple 331


14.2 332
14.3 333
14.3.1 333
14.3.2 335
14.4 335
14.4.1 336
14.4.2 337
14.4.3 339
14.5 339
14.5.1 340
14.5.2 LATEX 341
14.5.3 FORTRAN 341
14.6 343
14.7 343


Maple
Maple


Maple Maple
Maple Maple

Maple Maple
Maple

Maple

Maple

Maple 6
Maple

Maple 6

Maple 6
Maple
Maple Maple
Maple 6


a Maple
a Maple
a Maple
a Maple 6

1.1 Maple

Maple
Computer Algebra System

Maple


1959
MACSYMA

MACSYMA

1980 ()

Maple

Maple
Maple


Fortran

Maple

Maple
Maple Maple

Maple
Maple

Maple

Maple
Maple
Maple

Maple
Maple
Maple

Maple

1.2 Maple

Maple

Maple
Maple
Maple
Maple Maple

Maple Maple

OK
package_name with(package_name)

1.3 Maple

Maple

F. 16


20
18~19

Maple

Maple
Maple
Maple 6
Maple
Maple Windows
Maple 6
1-1
Maple 6 1-1 Maple 6
1-2

1-2

1.3.1


Maple

>
> 2+3;
; Maple
: Maple

;
> 2+3
Warning, premature end of input
;

%
> %;
5


/
> 2/3+1/7;
17
21
> 0.472+1.38;
1.852


> 2/3+1.38;
2.046666667

Maple

> 2^99;
633825300114114700748351602688

> 2001^11;

2059292202282269582789281320220022001

Maple Maple
Maple

> 0.25^99;
.2489206111 10 -59

> 1/4^99;
1
401734511064747568885490523085290650630550748445698208825344

evalf
%
evalf
> evalf(%);
.2489206111 10 -59

Maple

1.3.2

(a n x n + a n 1 x n 1 " a1 x + a 0 )

1.2.2 :=
5 a
> a:=5;
a := 5

Maple
MapleMaple
5 a ^ 2 a 25

> 2^a;
32

* a 2.4 52.4
> 2.4*a;
12.0

Maple

*Maple
> 2.4a;
Error, missing operator or `;`
' '
c a
> a:='c';
a := c

a a a

a Maple
> a^2+2.4*a;
a 2 + 2.4 a

Maple Maple
factor
> factor(x^3+5.0);
( x + 1.709975947 ) ( x 2 1.709975947 x + 2.924017740 )

> factor(x^3+y^3);
( y + x ) ( x2 x y + y2 )

Maple
expand

> expand(%);
x3 + y3


Maple

> p:=x^2+2*x-3:
>

%
> p;
x2 + 2 x 3

factor p
> factor(p);
(x + 3) (x 1)

1.3.3


Maple solve(Equation,var) Equation
var x 2 = 4

> solve(x^2 = 4, x);


2, -2


bx 2 = 4
> solve(b*x^2 = 4, x);
1 1
{x = 2 }, { x = 2 }
b b
p
> solve(p=0);
1, -3



Maple dsolve

y( x ) y( x ) 2 + y( x ) sin ( x ) cos ( x ) = 0

x
ode1 dsolve ode1=0
> ode1 := diff(y(x),x)-y(x)^2+y(x)*sin(x)-cos(x);
> ans1 := dsolve(ode1=0);
( cos ( x ) )
e
ans1 := y( x ) = sin( x )
_C1 +
( cos ( x ) )

e dx

diff

1.3.4

Maple

p=x^2+2*x-3 1-3

1-3 p

Maple 6 p x
solve

1-4 1-3

1-4

1-4

1-5
> plot(p,x=-5..3,y=-5..10);

1-5

Maple

> plot3d( sin(x*y) , x = -2..2, y = -1..1 );


1-6

1-6 sin(x*y)

1.3.5

Maple 1-7 Maple

1-7 Maple

Insert | SpreadSheet
Microsoft Excel
Maple

Maple

1.3.6

WordLATEX Maple
Maple
Maple Maple
Maple
Maple

1-8 Maple
Word

1-8 Maple

Word
Maple


x sin( x ) d x
2

0

> Int( x^2*sin(alpha*x), x=0..beta );

> int( x^2*sin(alpha*x), x=0..beta );


2 2 cos( ) 2 cos( ) 2 sin( ) + 2

3
Maple

Maple
1-9

1-9

Maple

View Bookmarks
Insert Hyperlink
Format Convert to Hyperlink

1-10example_Fexample_GSection
Section 2
1 Section 3Section BSection 3Section B
Section 1Section 2
Section 3
This section show the
Section B.2

example_GSection B.2example_G
example_F

1-10 Maple

1.3.7

Maple Maple
Maple Help Help
Topic Search 1-11

1-11

>?
1-12

1-12 ?

Maple

?+commandname?+
?^ 1-13

1-13 ? +commandname

1.4 Maple 6

Maple 6 Maple
GUI Excel 2000
Maple 6
Maple 6

Maple 6
Maple 6 RTF

Maple 6
Maple 6

Maple 6 NAG Maple 6

Maple 6 Microsoft Excel 2000


Excel Maple

1.5

Maple Maple
Maple
Maple
Maple

Maple Maple 6

Maple

Maple


a
a
a
a
a
a

7.1

Maple

f g f/g

7.1.1

a n x n + a n 1 x n 1 + " + a 2 x 2 + a1 x + a 0

n a n a n 1 a 0 a k x k k

a n 0 n an x n

Maple

> p1:=-3*x+7*x^2-3*x^3+7*x^4; #
p1 := 3 x + 7 x2 3 x3 + 7 x4

p1 x
7x 4 degree lcoeff
p1
> degree=degree(p1); #
degree = 4
> leading_coefficient:=lcoeff(p1); #
leading_coefficient := 7

type
type p1 type
true false

> type(p1,polynom); #
true

Maple
Maple
p2 p1
> p2:=5*x^5+3*x^3+x^2-2*x+1; #
p2 := 5 x5 + 3 x3 + x2 2 x + 1

> 2*p1-3*p2+3; #
11 x2 15 x3 + 14 x4 15 x5

Maple
expand collect
> p1*p2; #
( 3 x + 7 x2 3 x3 + 7 x4 ) ( 5 x5 + 3 x3 + x2 2 x + 1 )

> expand(%); #
17 x6 + 11 x4 20 x3 + 13 x2 3 x + 56 x7 + 4 x5 15 x8 + 35 x9

> collect(p1*p2,x); #
35 x9 15 x8 + 56 x7 17 x6 + 4 x5 + 11 x4 20 x3 + 13 x2 3 x

(3 x + 5)10 11
> (3*x+5)^10;
( 3 x + 5 )10

> expand(%);

59049 x10 + 984150 x9 + 7381125 x8 + 32805000 x7 + 95681250 x6 + 191362500 x5


+ 265781250 x4 + 253125000 x3 + 158203125 x2 + 58593750 x + 9765625

sort
> sort(%);
35 x9 15 x8 + 56 x7 17 x6 + 4 x5 + 11 x4 20 x3 + 13 x2 3 x

sort Maple

p
> p:=1+x+x^3+x^2; #
p := 1 + x + x3 + x2

p Maple

> x^3+x^2+x+1; # Maple

1 + x + x3 + x 2

p
> q:=(x-1)*(x^3+x^2+x+1);
q := ( x 1 ) ( 1 + x + x3 + x2 )

Maple
sort

> sort(p); # p
x 3 + x2 + x + 1

> q; # q
( x 1 ) ( x3 + x2 + x + 1 )

sort Maple p q

lcoeff

tcoeff coeff tcoeff coeff


p1 p2

> tcoeff(p2,x), tcoeff(p2-1,x); #


1, -2

> coeff(p1,x^4), coeff(p1,x,4); #


7, 7

coeffs
p2
> coeffs(p2,x,'powers'); # p2
1, -2, 3, 1, 5

> powers; #
1, x, x3, x2, x5

Maple
lcoefftcoeffcoeffs degree

collect
> lcoeff(x^2-x*(x-1),x); #
0

> lcoeff(collect(x^2-x*(x-1),x),x); #
1

> coeffs((x^2-1)*(x^2+1),x); #
Error, invalid arguments to coeffs
> coeffs(collect((x^2-1)*(x^2+1),x),x); #

-1, 1

> degree(x^2-x*(x-1),x); #
2

> degree(collect(x^2-x*(x-1),x)); #
1

Maple
quo rem
p2 p1
r
> q:=quo(p2,p1,x,'r'); # p2 p1
5 15
q := x +
7 49

> r; # p2 p1
53 3 2 53
1 x +x x
49 49

rem quo rem


p2 p1 p2 p1
e
> rem(p2,p1,x,'e'); # p2 p1
53 3 2 53
1 x +x x
49 49

> e; # p2 p1
5 15
x+
7 49

Maple gcd
p1 p2

> gcd(p1,p2); # p1 p2
x2 + 1


Maple factor
> polynomial:=p1*p2;
polynomial := ( 3 x + 7 x2 3 x3 + 7 x4 ) ( 5 x5 + 3 x3 + x2 2 x + 1 )

> expand(polynomial);
17 x6 + 11 x4 20 x3 + 13 x2 3 x + 56 x7 + 4 x5 15 x8 + 35 x9

> factor(%);
2
x ( 7 x 3 ) ( 5 x3 2 x + 1 ) ( x2 + 1 )

7.1.2


polynomial
> polynomial:=6*x*y^5+12*y^4+14*y^3*x^3-15*x^2*y^3+9*x^3*y^2
-30*x*y^2-35*x^4*y+18*x^2*y+21*x^5;

polynomial :=
6 x y5 + 12 y4 + 14 y3 x3 15 x2 y3 + 9 x3 y2 30 x y2 35 x4 y + 18 x2 y + 21 x5

Maple
sort

1 < y < x < y 2 < xy < x 2 < y 3 < xy 2 < x 2 y < x 3 "

> sort(polynomial); #
14 x3 y3 + 6 x y5 + 21 x5 35 x4 y + 9 x3 y2 15 x2 y3 + 12 y4 + 18 x2 y 30 x y2

Maple

1 < y < y 2 < " < x < xy < x 2 < "


polynomial x y

> sort(polynomial, [x,y], 'plex'); #


21 x5 35 x4 y + 14 x3 y3 + 9 x3 y2 15 x2 y3 + 18 x2 y + 6 x y5 30 x y2 + 12 y4


> collect(polynomial,x); #
21 x5 35 x4 y + ( 14 y3 + 9 y2 ) x3 + ( 18 y 15 y3 ) x2 + ( 30 y2 + 6 y5 ) x + 12 y4

coeff coeffs
factor polynomial x3

> coeff(polynomial, x^3), coeff(polynomial, x, 3);


14 y3 + 9 y2, 14 y3 + 9 y2

coeff x3y2
> coeff(coeff(polynomial, x^3), y^2); # x3y2
9

x coeffs factor

> coeffs(polynomial, x, 'powers'); powers; # x

12 y4, 30 y2 + 6 y5, 14 y3 + 9 y2, 18 y 15 y3, 21, 35 y

1, x, x3, x2, x5, x4

> factor(polynomial); #
( 3 x2 5 x y + 2 y 3 ) ( 7 x3 + 6 y + 3 x y2 )


Maple

7.1.3

f g x g 0 f/g

x
> f:=x^2+3*x+2; g:=x^2+5*x+6;

f := x2 + 3 x + 2

g := x2 + 5 x + 6

> h:=f/g;
x2 + 3 x + 2
h :=
x2 + 5 x + 6
h
Maple numer denom
unmer denom

> numer(h); #
x2 + 3 x + 2

> denom(h); #
x2 + 5 x + 6

Maple

ff gg ff/gg (x-1)
(x+2)
> ff:=(x-1)*f;
ff := ( x 1 ) ( x2 + 3 x + 2 )

> gg:=(x-1)^2*g;
gg := ( x 1 )2 ( x2 + 5 x + 6 )

> ff/gg;
x2 + 3 x + 2
( x 1 ) ( x2 + 5 x + 6 )

normal
> normal(h); # h
x+1
x+3

> normal(ff/gg); # ff/gg


x+1
(x + 3) (x 1)

Maple
(1) (x10000-1)/(x-1)
10000

(2) Maple

(3)


ratexpr
ratexpr
>
f:=161*y^3+333*x*y^2+184*y^2+162*x^2*y+144*x*y+77*y+99*x+88;
f := 161 y3 + 333 x y2 + 184 y2 + 162 x2 y + 144 x y + 77 y + 99 x + 88

> g:=49*y^2+28*x^2*y+63*x*y+147*y+36*x^3+32*x^2+117*x+104;
g := 49 y2 + 28 x2 y + 63 x y + 147 y + 36 x3 + 32 x2 + 117 x + 104

> ratexpr:=f/g;
161 y3 + 333 x y2 + 184 y2 + 162 x2 y + 144 x y + 77 y + 99 x + 88
ratexpr :=
49 y2 + 28 x2 y + 63 x y + 147 y + 36 x3 + 32 x2 + 117 x + 104
> factor(f); factor(g);
( 18 x y + 23 y2 + 11 ) ( 7 y + 9 x + 8 )

( 7 y + 4 x2 + 13 ) ( 7 y + 9 x + 8 )

> normal(ratexpr);
18 x y + 23 y2 + 11
7 y + 4 x2 + 13

7.2

7.2.1 (simplify)


simplify

> simplify(4^(1/2)+3); #

> simplify(exp(a+ln(b*exp(c)))); #
(a + c)
be

simplify power
trig
> simplify((x^a)^b+4^(1/2), power); #
b
( xa ) + 2

> simplify(sin(x)^2+cos(x)^2-1/3*(x^5)^(1/5)*y,trig); #

1 ( 1/5 )
1 ( x5 ) y
3


simplify
(1)
> 3+5-2*3;
2

> 2.5*10.0-2.0^4;
9.0000

(2)
> 9*25*121/(11*60);
165
4

(3)
> expr1:=(x^2+3*x+2)/(x+1);
x2 + 3 x + 2
expr1 :=
1+x
> expr2:=(x+1)*(x+2)/(1+x);
expr2 := x + 2

(4)
> x+x-y*y;
2 x y2

(5)
> sin(Pi/4), cos(Pi/6), ln(1);
1 1
2, 3, 0
2 2

> sin(Pi/5), cos(Pi/7), ln(10);

sin , cos , ln( 10 )


1 1
5 7

7.2.2 (expand)


(x + y )(x y ) (x 2 y 2 )
(x 2 x )(x 2 + 2 x + 1) (x 4 + x 3 x 2 x ) expand
sort
> partially_fractored_form:=(x^2-x)*(x^2+2*x+1); #

partially_fractored_form := ( x2 x ) ( x2 + 2 x + 1 )

> expand_form:=expand(partially_factored_form); #

expand_form := partially_factored_form

Maple (x 2 x ) (x 2 + 2 x + 1)
(a + b )(c + d ) (a(c + d ) + b(c + d ))
(ac + ad + bc + bd )
expand (a + b )(c + d )
> factored_form:=(a+b)*(c+d):
> expanded_form:=expand(factored_form);
expanded_form := a c + a d + b c + b d

(c + d )
> partially_expanded_form:=expand(factored_form, c+d);
partially_expanded_form := ( c + d ) a + ( c + d ) b

Maple
Maple expand
Maple expand
> power:=(x+1)^3; #
power := ( x + 1 )3

> expand(%);
x3 + 3 x2 + 3 x + 1

> power:=(x+1)^(3/2); #

( 3/2 )
power := ( x + 1 )
> expand(%);
( 3/2 )
(x + 1)

> power:=(x+1)^(-2); #
1
power :=
( x + 1 )2
> expand(power);
1
( x + 1 )2
(x + 1)2
denom
> 1/expand(denom(%));
1
x +2x+1
2

7.2.3 (combine)


combine combine

e1 trig

> e1:=2*cos(x/2)^2-1;
2

e1 := 2 cos x 1
1
2
> combine(e1, trig); #
cos ( x )

e exp
ln e3 e

> interface(showassumed=0); #
> assume(x>0,y>0): # x y
> e3:=(exp(x))^2*exp(y)+2*ln(x)-ln(y)+(x^a)^2; # e3
2 2
e3 := ( e x ) e y + 2 ln( x ) ln( y ) + ( x a )

> combine(e3, exp); # e


(2 x + y) 2
e + 2 ln( x ) ln( y ) + ( x a )

> combine(e3, ln); #


2 2 x2
( e x ) e y + ( xa ) + ln
y
combine(, power) e3

> combine(e3, power); #


(2 x + y) (2 a )
e + 2 ln( x ) ln( y ) + x

combine

combine

> combine([e1, e3], {exp, ln, trig}); #


(2 x + y) 2
[ cos( x ), e + 2 ln( x ) ln( y ) + ( xa ) ]

7.2.4 (normal)

(1)
(2)(3)

( 2 x + 4 y ) ( x2 y2 )
+x+y
( x + y )2

3 x2 + 4 x y 3 y2
x+y

Maple
normal
normal
> (x-1)*(x+2)/((x+1)*x)+(x-1)/(1+x)^2;
(x 1) (x + 2) x1
+
(x + 1) x ( x + 1 )2
> normal(%); #
( x 1 ) ( x2 + 4 x + 2 )
( x + 1 )2 x

normal expanded

> normal(%%, 'expanded');


x3 + 3 x2 2 x 2
x 3 + 2 x2 + x

> sin(x+1/x)+1/sin(x+1/x);

sin x + +
1 1
x
sin x +
1
x

> normal(%); #
2
1 + x2
sin +1
x
1 + x2
sin
x
> normal(%, 'expanded'); #
2 2

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


1 1 1 1
x x x x
sin( x ) cos + cos( x ) sin
1 1
x x

7.2.5 (collect)

collect collect

> poly:=expand((x+y+z)^2*(x+y+1));

poly := x 3 + 3 x 2 y + x 2 + 3 x y 2 + 2 x y + 2 x 2 z + 4 x z y + 2 x z + y 3 + y 2 + 2 y 2 z + 2 y z
+ z2 x + z2 y + z2

z xy poly
> collect(poly,z); # z
( x + y + 1 ) z2 + ( 4 x y + 2 x + 2 x2 + 2 y2 + 2 y ) z + x3 + 3 x2 y + x2 + 3 x y2 + 2 x y + y2 + y3

xy

> collect(poly, [z,y], 'recursive'); # z y

( x + y + 1 ) z2 + ( 2 y2 + ( 4 x + 2 ) y + 2 x + 2 x2 ) z + y3 + ( 3 x + 1 ) y2 + ( 3 x2 + 2 x ) y + x3
+ x2

recursive y
distributed Maple x yz

> collect(poly, [z,y], 'distributed');

x3 + x2 + ( 3 x2 + 2 x ) y + ( 2 x + 2 x2 ) z + ( 4 x + 2 ) y z + ( x + 1 ) z2 + ( 3 x + 1 ) y2 + y3
+ 2 y2 z + z2 y

Maple collect
z poly
xy
> collect(poly, z, factor);
( x + y + 1 ) z 2 + 2 ( x + y + 1 ) ( x + y ) z + ( x + y + 1 ) ( x + y )2

> collect(poly, [z,y], 'distributed', factor);

x2 ( x + 1 ) + x ( 3 x + 2 ) y + 2 x ( x + 1 ) z + ( 4 x + 2 ) y z + ( x + 1 ) z2 + ( 3 x + 1 ) y2 + y3
+ 2 y2 z + z2 y

poly 15
z 3

collect collect

> x^5-5*x^4*y^2+10*x^3*y^4-10*x^2*y^6+5*x*y^8-y^10-2;
x5 5 x4 y2 + 10 x3 y4 10 x2 y6 + 5 x y8 y10 2

(x y 2 ) (x y 2 )

> collect(%, x-y^2);


Error, (in collect) cannot collect x-y^2

z = x y 2 z
> siderel:={z=x-y^2}; #
siderel := { z = x y2 }

> simplify(%%, siderel, [x,y,z]); #


2 + z 5

> subs(siderel, %); # z


5
2 + ( x y2 )

7.2.6 (sort)

Maple sort
sort
sort sort(expression)

> c:=expand((x^2+x+1)^5); #
c := 1 + 5 x + x10 + 5 x9 + 15 x8 + 30 x7 + 45 x6 + 15 x2 + 30 x3 + 51 x5 + 45 x4

> sort(c); #
x10 + 5 x9 + 15 x8 + 30 x7 + 45 x6 + 51 x5 + 45 x4 + 30 x3 + 15 x2 + 5 x + 1

> sort([z,u,w,s,u,v,w,y,t]); #
[ s, t, u, u, v, w, w, y, z ]
> sort([3,2,1]); #
[ 1, 2, 3 ]

sort
x x x
sort
> e:=1+x^4*y*z+y^5*z^2*x+x*y^2*z^3;
e := y5 x z 2 + y2 x z 3 + y x4 z + 1

> sort(e, [x,y,z]);


x y5 z 2 + x4 y z + x y2 z 3 + 1

sin(x) cos(x)

> (-sin(x)+cos(x))/(cos(x)+sin(x));

cos( x ) sin( x )
cos( x ) + sin( x )

> sort(%, [sin(x),cos(x)], plex); # sin(x) cos(x)

sin( x ) + cos( x )
sin( x ) + cos( x )

> sort(%%, [cos(x),sin(x)], plex); # cos(x) sin(x)

cos( x ) sin( x )
cos( x ) + sin( x )

7.2.7 (convert)

convert
convert
conver t


evalf convert
fraction
> convert( 1.23456, fraction ); #
3858
3125

> evalf(%); #
1.234560000

convert
binary
octal hex
> convert(17, binary); #
10001

> convert(17, octal); #


21

> convert(17, hex); #


11

convert
101

decimal binary 101


> convert(101,decimal,binary); #
5


` `

> convert(23,decimal,octal); #
19

> convert(`1A`,decimal,hex); #
26

convert
(1,2,3,4) f
> convert( [1,2,3,4], `+` ); #
10

> convert(sin(x)*(y-x),`+`); #
sin( x ) + y x

> f := seq( x[i]^i, i=1..4 ); #


2 3 4
f := x1, x2 , x3 , x4

> convert([f], `*`); #


2 3 4
x1 x2 x3 x4

> convert(sin(x)+y-x,`*`); #
sin( x ) y x

convert + *

sin(x)*(y-x) sin(x)y-x
+
* sin(x)y-x
convert
simplify simplify

>
expr:=cos(a)^2*cos(b)^2-2*cos(a)*cos(b)*sin(a)*sin(b)+sin(a)^2
*sin(b)^2; #

expr := cos( a )2 cos( b )2 2 cos( a ) cos( b ) sin( a ) sin( b ) + sin( a )2 sin( b )2

> simplify(expr); # simplify


2 cos( a )2 cos( b )2 2 cos( a ) cos( b ) sin( a ) sin( b ) + 1 cos( b )2 cos( a )2

Maple expr
convert expr
combine expr

> combine(expr, trig); #


1 1
cos( 2 a + 2 b ) +
2 2

> convert(%, tan); #


1 1 tan( a + b )2 1
+
2 1 + tan( a + b )2 2


convert sincos
> convert(%, sincos); #
sin( a + b )2
1
1 cos( a + b ) 2 1
+
2 sin( a + b )2 2
1+
cos( a + b ) 2
simplify

> simplify(%);
cos ( a + b ) 2

7.2.8 (factor)

Maple
factor
> factor(6*x^2+18*x-24);
6 (x + 4) (x 1)

factor(exp) factor(exp, K) exp


K exp
ifactor
> factor(6);
6

factor

> factor((x^3-y^3)/(x^4-y^4));
x2 + x y + y2
( y + x ) ( x2 + y2 )
x 2 + 4
( x + 2i )( x 2i ) Maple factor

Maple

> factor(x^3+5); #
x3 + 5

> factor(x^3+5.0); #
( x + 1.709975947 ) ( x2 1.709975947 x + 2.924017740 )

> factor(x^3+5,complex); #
( x + 1.709975947 ) ( x .8549879733 + 1.480882610 I )
( x .8549879733 1.480882610 I )
factor
Maple

> factor(x^3+5, 5^(1/3)); # 5(1/3)


( 1/3 ) ( 2/3 ) ( 1/3 )
( x2 x 5 +5 ) (x + 5 )

> factor(y^4-2,sqrt(2)); # 2

( y 2 ) ( y2 + 2 )
2

> factor(x^3+y^3,(-3)^(1/2)); # 3
1
( 2 x y y -3 ) ( 2 x y + y -3 ) ( y + x )
4

7.3


Maple


Maple
Maple
Maple

Maple solve

> eqn1 := x^4-5*x^2+6*x=2; # 1


eqn1 := x4 5 x2 + 6 x = 2

> solve(eqn1,x);
1, 1, 1 + 3 , 1 3

> solve({(x-1)*(x^2+3*x+2)},{x}); # 2
{ x = 1 }, { x = -1 }, { x = -2 }

solve


Maple
Maple
Maple

> solve( f=m*a, a ); # 1


f
m

> eqn3:=a*x^2+b*x+c=0; # 2
eqn3 := a x2 + b x + c = 0

> solve(eqn3,x);
1 b + b2 4 a c 1 b b2 4 a c
,
2 a 2 a

eqn2 sols sols[i] i

> eqn2:=(x-1)*(x^2+3*x+2)=0: eqn2


> sols := [solve(eqn2,x)]; # sols
sols := [ 1, -1, -2 ]

> sols[3], sols[2], sols[1]; # eqn2


-2, -1, 1

Maple
solve solve

> solve(x+x^(1/2)+x^(1/3)+x^(1/4)=4,x);
1

> solve((x^6-1)^x=0,x);
1 1
1, 2 + 2 I 3 , 2 2 I 3
2 2

Maple
solve
Maple Maple
max min Maple
simplify

> solve(max(x,2*x-2)=min(x^2-1,5-x),x);
7 1 1 1 1
, 5, 5+
3 2 2 2 2
> simplify(solve(arccos(3*x)=2*arcsin(x),x));
3 1
+ 17
4 4

Maple

> abs(x+abs(x+1))=1;
x+ x+1 =1

> solve({%},{x});
{ x = 0 }, { x -1 }

7.4

solve
(1)
(2)

7.4.1

solve
{ }

> eqns:={x+2*y=3, y-1/2*x=1}; #


1
eqns := { x + 2 y = 3, y x = 1 }
2

> solve( eqns, {x,y} ); #


1 5
{x = , y = }
2 4

Maple
Maple
ab k xy
Maple
> eqnset:={x+y=b, a*x-2/3*y=k}; #
2
eqnset := { a x y = k, x + y = b }
3

> solve(eqnset); #
3 3 3 3
{ y = a x k, b = x + a x k, k = k, x = x, a = a }
2 2 2 2


> solve(eqnset, {x,y}); #

3k+2b abk
{x = ,y=3 }
3a+2 3a+2


xyztu

> #
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, u = 16, y = 3, z = -1, x = 2 }

tu

> s2:=solve({eqn1,eqn2,eqn3},{x,y,z});
635 70 70 59 527 28
s2 := { y = + 12 t + u, z = 7 t u, x = 7 t u}
13 13 13 13 13 13

tu xyz
> subs({u=1,t=1},s2); #
-220 -646 861
{z = ,x= ,y= }
13 13 13

7.4.2


Maple subsmap testeq

(1) subs subs(var, eqns) var


eqns eqns
soln
> eqns:={x+2*y=3, y+1/x=1};
1
eqns := { x + 2 y = 3, y + = 1}
x

> soln:=solve(eqns, {x,y}); #


1
soln := { y = 2, x = -1 }, { x = 2, y = }
2

subs
> subs(soln[1], eqns); # eqns soln[1]
{ 3 = 3, 1 = 1 }

> subs(soln[2], eqns); # eqns soln[2]


{ 3 = 3, 1 = 1 }

subs
eqns
x y eqns
> subs([x=2,y=1], eqns);
3
{ 4 = 3, = 1}
2

(2) map map(command, para_1,


para_2) para_1para_2 command
para_i map
map f([a,b,c],y,z)[a,b,c]
Maple
> map(f, [a,b,c], y, z);
[ f( a, y, z ), f( b, y, z ), f( c, y, z ) ]
map map
eqns subs([soln[1],soln[2]],eqns)
> map(subs, [soln], eqns);
[ { 3 = 3, 1 = 1 }, { 3 = 3, 1 = 1 } ]

(3) testeq
true false
a b
> a := (sin(x)^2 - cos(x)*tan(x)) * (sin(x)^2 + cos(x)*tan(x))^2;
2
a := ( sin ( x ) 2 cos( x ) tan( x ) ) ( sin( x ) 2 + cos( x ) tan( x ) )

> b := 1/4*sin(2*x)^2 - 1/2*sin(2*x)*cos(x) - 2*cos(x)^2


+ 1/2*sin(2*x)*cos(x)^3 + 3*cos(x)^4 - cos(x)^6;
1 1 1
b := sin ( 2 x ) 2 sin ( 2 x ) cos ( x ) 2 cos ( x ) 2 + sin ( 2 x ) cos ( x ) 3 + 3 cos ( x ) 4 cos ( x ) 6
4 2 2
> testeq( a = b ); # a b
true

map testeq

> map(testeq, subs(soln[1], eqns));


{ true }

> map(testeq, subs(soln[2], eqns));


{ true }

7.4.3


Maple

solve
x 2 + y 2 = 25
y = x2 5
> eqns:={x^2+y^2=25, y=x^2-5}; #
eqns := { x2 + y2 = 25, y = x2 5 }

> vars:={x,y}; #
vars := { x , y }

> solve(eqns,vars); #
{ x = 0, y = -5 }, { x = 0, y = -5 }, { y = 4, x = 3 }, { x = -3, y = 4 }

x2 + y2 = 1
x + y = x2 y2

> eqns:={x^2+y^2=1, sqrt(x+y)=x^2-y^2}; #


eqns := { x + y = x2 y2, x2 + y2 = 1 }

> vars:={x,y}: #
> sols:=solve(eqns,vars); #

3
sols := { x = 4 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 )
+ 3 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 ) + 2
2
2 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 ) ,

y = RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1 , -.3269928304 ) },
{ y = RootOf ( 2 _Z 2 1 ), x = RootOf ( 2 _Z 2 1 ) }, { y = 0 , x = 1 }, { x =
3
4 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1 , -.8090169944 + .3930756889 I )
+ 3 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1 , -.8090169944 + .3930756889 I ) + 2

2
2 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1 , -.8090169944 + .3930756889 I ) ,
y = RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.8090169944 + .3930756889 I ) }


Maple
RootOf

> sols[2];
{ y = RootOf ( 2 _Z 2 1 ) , x = RootOf ( 2 _Z 2 1 ) }

allvalues

> s2:=allvalues(sols[2], 'dependent'); #


1 1 1 1
s2 := { y = 2 , x = 2 }, { y = 2, x = 2 }
2 2 2 2

RootOf
convert RootOf

> sols[1];

3
{ x = 4 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 )
+ 3 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 ) + 2
2
2 RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1, -.3269928304 ) ,

y = RootOf ( 4 _Z 4 + 4 _Z 3 2 _Z 2 4 _Z 1 , -.3269928304 ) }

> convert(%, radical); # RootOf

2 + 2 5 , x = 4 + 2 + 2 5 + +
1 1 1 1 1 1 5 3
{y = + 5 5 5
4 4 4 4 4 4 4 4
2

2 + 2 5 2 + 2 + 2 5 }
3 1 1 1
5
4 4 4 4
> s1:=simplify(%); #
1 1 1 1 1 1
s1 := { y = + 5 2+2 5,x= + 5 + 2+2 5 }
4 4 4 4 4 4

Maple

sols[4]
> convert(sols[4], radical); # RootOf

2 2 5 , x = 4 2 2 5 +
1 1 1 1 1 1 5 3
{y = 5+ 5+ 5
4 4 4 4 4 4 4 4
2

2 2 5 2 2 2 5 }
3 1 1 1
+ 5+
4 4 4 4
> s4:=simplify(%);#
1 1 1 1 1 1
s4 := { x = 5 I 2 + 2 5 , y = 5 + I 2 + 2 5 }
4 4 4 4 4 4

sols[3]

> s1,s2,sols[3],s4;

1 1 1 1 1 1 1 1
{y = + 5 2+2 5,x= + 5 + 2 + 2 5 }, { y = 2 , x = 2 },
4 4 4 4 4 4 2 2
1 1
{ y = 2 , x = 2 }, { y = 0, x = 1 },
2 2

1 1 1 1 1 1
{ x = 5 I 2 + 2 5 , y = 5 + I 2 + 2 5 }
4 4 4 4 4 4

subsmaptesteq sols[2]
RootOf subs sols[2] simplify
sols[2]
> simplify(subs(sols[2], eqns));
{ 0 = 0, 1 = 1 }

> map(testeq, subs(sols[2], eqns));


{ true }

7.5


solve
solve
rsolve solve rsolve

rsolve
rsolve
Maple
Maple

> fsolve(cos(x)=x);
.7390851332

> fsolve( tan(sin(x))=1, x );


.9033391108

solve rsolve

Maple 0
fsolve
complex
> q := 3*x^4 - 16*x^3 - 3*x^2 + 13*x + 16:
> fsolve(q, x, complex); #
-.6623589786 .5622795121 I, -.6623589786 + .5622795121 I, 1.324717957 ,
5.333333333
fsolve Maple

Maple
> poly := 23*x^5 + 105*x^4 - 10*x^2 + 17*x; #
poly := 23 x5 + 105 x4 10 x2 + 17 x

> fsolve( poly, x); #


-4.536168981, -.6371813185, 0.

> fsolve( poly, x, -1..1 ); #


-.6371813185, 0.

> fsolve(sin(x),x=3.1); #
3.141592654

Maple (1, )
avoid
> f:=10-(ln(v+(v^2-1)^(1/2))-ln(3+(3^2-1)^(1/2))); #
f := 10 ln ( v + v 2 1 ) + ln( 3 + 8 )

> fsolve(f,v,1..infinity); #
64189.82535

> fsolve(sin(x), x, avoid={x=0,x=Pi,x=-Pi}, -10..10); #

-6.283185307

Maple

> fsolve(q, x, 2..5);


>
fsolve
fsolve

Maple
f g
> f := sin(x+y)-exp(x)*y; g := x^2 - y - 2; #
f := sin( x + y ) e x y = 0

g := x2 y = 2

> s1:=fsolve({f,g},{x,y}); #
s1 := { x = -6.017327250, y = 34.20822723}

Maple

> s2:=fsolve({f,g},{x,y},{x=-1..1,y=-2..0});
s2 := { x = -.6687012050, y = -1.552838698}

> s3:=fsolve({f,g},{x,y},{x=-10..0,y=0..35});
s3 := { x = -2.096487462, y = 2.395259676}

subs
> simplify(subs(s1,{f,g})); # s1
{ 0., .4260000000 10 -8 }

> simplify(subs(s2,{f,g})); # s2
{ 0., -.5000000000 10 -9 }

> simplify(subs(s3,{f,g})); # s3
{ .2000000000 10 -8, -.7000000000 10 -9 }

Maple
f g 7-1
> plot3d({f,g},x=-1..1,y=-2..5); #

7-1 f g

Maple

> #
f:=sin(a+b)-log[10](a)*b=0;
g:=a-b^2=1;
ln( a ) b
f := sin( a + b ) =0
ln( 10 )

g := a b2 = 1

> fsolve({f,g},{a,b},{a=-1..0, b=0..2}); # Maple

fsolve { sin ( a + b ) = 0, a b2 = 1 }, { a, b }, { a = -1 .. 0, b = 0 .. 2 }
ln ( a ) b
ln ( 10 )

7.6

><=

(x 3 + 4 x 2 + 2 x + 1) 7-2
> plot(x^3+4*x^2+2*x-1, x=-4..1);

7-2 (x 3 + 4x2 + 2x + 1 )

7-2 x
x solve
> solve(x^3+4*x^2+2*x-1>0,x); #

RealRange Open 13 , Open ( -1 ) , RealRange Open + 13 ,


3 1 3 1
2 2 2 2

Open
Maple

> solve({x^3+4*x^2+2*x-1>0},{x});
3 1 3 1
{ x < -1, 13 < x }, { + 13 < x }
2 2 2 2

Maple > <<>=


<= <>

> solve((x-1)*(x-2)*(x-3) <= 0, {x});


{ x 1 }, { x 3, 2 x }

> solve(a^2*x^2 >= 0, x);


x
Maple x

7-3
x

> plot({x^2-9, x^3-2},x=-4..4);


7-3 x^2-9 x^3-2

solve
> solve({x^2-9<0, x^3-2<0}); #
( 1/3 )
{x < 2 , -3 < x }


Maple
> assume(a<0):
> solve(a*x < 0, {x});
{0 < x}

7.7

Maple

Maple Maple

Maple
sin(x)=0
Maple
> solve({sin(x)=0},{x});
{x = 0}

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

{ x = 3.141592654}

Maple

Maple

7.7.1

solve

(1)
> solve(x=x+1,x);
>

(2) RootOf
> solve(cos(x)=x,x);
RootOf ( _Z cos ( _Z ) )

> evalf(%);
.7390851332

RootOf simplify
evalfconvert
(3)
> eqn:=x+x^(1/3)=-2;
( 1/3 )
eqn := x + x = -2

> solve(eqn,x);
>
x=-1 Maple

> solve((x+2)^3+x,x);
5 1 5 1
a := -1, + I 7 , I 7
2 2 2 2

7.7.2

Maple
solve fsolve

> plot({exp(cos(x)),ln(2+sin(x))},x=-3*Pi..3*Pi);

7-4 exp(cos(x)) lin(2+sin(x))

> solve({exp(cos(x))=ln(2+sin(x))},{x}):
> evalf(%);
{ x = -2.637346485}

Maple exp(cos(x))=lin(2+sin(x)) 7-4


exp(cos(x)) lin(2+sin(x))
(0,2)(6,8)

> fsolve({exp(cos(x))=ln(2+sin(x))},{x},0..2);
{ x = 1.477924405}

> fsolve({exp(cos(x))=ln(2+sin(x))},{x},6..8);
{ x = 7.761109712}

sin ( x ) = 3 x solve RootOf


> solve(sin(x)=3*x/Pi, x);


RootOf ( 3 _Z sin ( _Z ) )

> evalf(%);

0.

> plot({sin(x), 3*x/Pi},x=-0.55..0.55);

7-5 sin(x) 3x/

Maple 7-5 y = sin(x ) y = 3x


0
6 6
fsolve Maple
> fsolve({sin(x)=3*x/Pi}, {x},-0.8..-0.4);
{ x = -.5235987756}

> fsolve({sin(x)=3*x/Pi}, {x},0..1);


{ x = .5235987756}

7.8

Maple

Maple

Maple

11

Maple

Maple LinearAlgebra linalg


a
a
a
a

11.1

Maple LinearAlgebra linalg


linalg
vector matrix LinearAlgebra Vector Matrix
linalg
LinearAlgebra

11.2


Maple (a, b,
c)[a, b, c]

Maple

11.2.1

Vector
Vector row
Vector column
> with(LinearAlgebra):
> u1:=Vector[row]([1,2,3]); #
u1 := [ 1, 2, 3 ]

> u2:=Vector[column]([1,2,3]); #
1

u2 := 2

3
Maple
Vector
v1 5 3
v2 3

> v1:=Vector([5,3]);

v1 :=
5
3
> v2:=Vector(5,3);

3

3

v2 := 3
3

3

0
> v3:=Vector(1..3); #
0

v3 := 0

0
> v4:=Vector(1..3,[a,2,c]); # v4
a

v4 := 2

c
> a:=1: c:=3: #
> v4; # v4
1

2
3

<><a|b|c>
<a, b, c>
> < a | b | c >;
[ a, b, c ]

> < a, b, c >;


a

b
c

11.2.2

VectorAdd ScalarMultiply

CrossProductDotProduct
VectorAngle
(1) u v
t u v

> u:=Vector[row]([1,2,3]);
u := [ 1, 2, 3 ]

> v:=Vector[column]([1,2,3]);
1

v := 2

3
> VectorAdd(u,v);
Error, (in LinearAlgebra:-VectorAdd) vectors must have the same
orientation
u v
v u
> v:=<1|2|3>;
v := [ 1, 2, 3 ]

> VectorAdd(u,v);
[ 2, 4, 6 ]

(2) a
v v a
> ScalarMultiply(v,a);
[ a, 2 a, 3 a ]

Maple
Maple a*u-b*v
> VectorAdd(u,v,a,-b);
[ a b, 2 a 2 b, 3 a 3 b ]

(3) VectorAngle

> V1 := <1,0,1>;
1

V1 := 0

1
> V2 := <1,1,0>;

1

V2 := 1

0
> VectorAngle(V1, V2); # V1 V2
1

3

(4) DotProduct u v
u v u v

> DotProduct(V1,V1); # V1
2

> DotProduct(V1,V2); # V1 V2
1

(4) CrossProduct u v
u v u v u v

> V3:=CrossProduct(V1,V2); # V1 V2
-1

V3 := 1

1
> VectorAngle(V3, V1); # V3 V1
1

2

> VectorAngle(V3, V2); # V3 V2


1

2

11.3

mn
m n

mn A A mn(aij) aiji=1,2,,m;


j=1,2,,n i j

11.3.1

Maple Matrix
> Matrix([[1,2,3],[4,5,6]]);
1 2 3

4 5 6

Maple
0
> Matrix(2); # 22
0 0

0 0
> Matrix(2,3); # 23
0 0 0

0 0 0


Matrix
> f:= (i,j) -> x^(i+j-2): #
Matrix(2,f);
1 x

x x2

<> Matrix

> < < 1 | 2 | 3 >, < 4 | 5 | 6 > >;


1 2 3

4 5 6

Matrix <> 33


1 0
> Matrix(<<1,0,0>|<0,1,0>|<0,0,1>>);
1 0 0

0 1 0
0
0 1

11.3.2


MatrixAddMatrixScalarMultiplyMatrixMatrixMultiply
MatrixVectorMultiply VectorMatrixMultiply

DeterminantMatrixInverse
(1)
MatrixAdd

> A:=Matrix(<<a,c>|<b,d>>);

A :=
a b

c d
> B:=Matrix(<<e,f>|<g,h>>);

B :=
e g

f h
> MatrixAdd(A,B);
a + e b + g

c + f d + h

(2)
ScalarMultiply MatrixScalarMultiply
> ScalarMultiply(A,2);
2 a 2 b

2 c 2 d
> MatrixScalarMultiply(A,2);
2 a 2 b

2 c 2 d
(3) MatrixMatrixMultiply
mn m
nA22 C23 23
> C:=Matrix(<<1,0>|<0,1>|<1,1>>);

C :=
1 0 1

0 1 1
> MatrixMatrixMultiply(A,C);
a b a + b

c d c + d

n 1n
n n1
(4) Maple Determinant (aij)

1 n
22 A
> Determinant(A);
ad bc

(5) M N M N
0 Maple
MatrixInverse A
> MatrixInverse(A);
d b
a d + b c a d + b c

c a
a d + b c
a d + b c

LinearAlgebra
Maple evalm
11-1

11-1

+ evalm(A+B)
&* evalm(A&*v)
^(-1) evalm(A^(-1))
^(n) evalm(A^3)

A B A
B
> evalm(A+B); # MatrixAdd
a + e b + g

c + f d + h

A B
> evalm(A&*B); # MatrixMatrixMultiply
a e + b f a g + b h

c e + d f c g + d h

n A MatrixMatrixMultiply
evalm A n n=3
> evalm(A^(3));

( a 2 + b c ) a + ( a b + b d ) c ( a 2 + b c ) b + ( a b + b d ) d

( c a + d c ) a + ( b c + d ) c ( c a + d c ) b + ( b c + d ) d
2 2

A -1 A
> evalm(A^(-1)); # Inverse
d b
a d + b c a d + b c

c a
a d + b c
a d + b c

11.3.3


delrows delcolsswaprow swapcol
mulrow mulcoladdrow addcol
linalg with
linalg matrixvector
M0
> with(linalg):
> M0:=matrix([[4,5,6],[1,2,3],[7,8,9]]);
4 5 6

M0 := 1 2 3

7 8 9

delrows delcols M0 M0
23
> delrows(M0, 1..1); # M0
1 2 3

7 8 9

> delcols(M0, 1..2); # M0


6

3
9

> whattype(%); #
array

M0 swaprow
addrow M0 M0
> swaprow(M0, 1, 2);

1 2 3

4 5 6
7
8 9

-4 -7
0
> addrow(%,1,2,-4);
1 2 3

0 -3 -6
7
8 9

> addrow(%,1,3,-7);
1 2 3

0 -3 -6
0
-6 -12

-2 M1
> M1:=addrow(%,2,3,-2);
1 2 3

M1 := 0 -3 -6

0 0 0

M0
M1
(aij) aij aji
linalg transpose
M1
> M1_trans:=transpose(M1);
1 0 0

M1_trans := 2 -3 0

3 -6 0

11.4

x + y + z = 2

2 y + 5z = 3
3x + 8 z = 4

K
AxK = b

1 1 1 x 2
0 2 5 y = 3

3 0 8 z 4
K
A x xyz
K
b Maple

> with(linalg):
> A:=matrix(3,3,[[1,1,1],[0,2,5],[3,0,8]]);
1 1 1

A := 0 2 5

3 0 8

> b:=vector([2,3,4]);
b := [ 2, 3, 4 ]


linsolve

11.4.1

Gauss-Jordan
K K
augment A b b A

gaussjord backsub
K
Gauss-Jordan AxK = b
K
> # A b M
M:=augment(A,b);
1 1 1 2

M := 0 2 5 3

3 0 8 4

> # Gauss
gaussjord(M);
1 4
0 0
5

0 1 0 1


0 1
0 1
5
> # sols
sols:=backsub(%);

sols := , 1,
4 1
5 5

gaussjord
evalm sols

> evalm(A&*sols);
[ 2, 3, 4 ]

K
b

11.4.2


K
A A(-1) xK = A ( 1) b
linalg detLinearAlgebra Determinant
A 0
> det(A);
25

A 0 inverse
> inverse(A);
16 -8 3
25 25 25
3 1 -1

5 5 5

-6 3 2
25 25 25
K
A(-1) b

> multiply(%, b);


4, 1, 1

5 5

11.4.3 linsolve

Maple linsolve
linsolve

A
linsolve 11.4.1

> linsolve(A, b);


4, 1, 1

5 5

Maple
_ti i 11.4.1 4
A 34
> B:=augment(A,[1,2,3]);
1 1 1 1

B := 0 2 5 2

3 0 8 3

linsolve
> linsolve(B, b);
3 _t + 1, 2 + 5 _t , _t , 25 _t + 5

2 1 2 3 3 1 1 6 1 6

11.5


Maple

Maple LinearAlgebra
linalg

You might also like