Robert M. Corless
Department of Applied Mathematics
University of Western Ontario
London, Canada

Copyright 2001 by Robert M. Corless
All rights reserved

Programming in Maple 

Программирование в Maple

Data structures 

Структуры данных

> restart;
> f := 1 + (x+z)^3 + tan((x+z)^3)*sin(y);

f := 1+(x+z)^3+tan((x+z)^3)*sin(y)

> nops(f);

3

> op(1,f);

1

> op(2,f);

(x+z)^3

> op(3,f);

tan((x+z)^3)*sin(y)

> op(1,op(2,f));

x+z

> op(1,op(3,f));

tan((x+z)^3)

> restart;
> e_seq := 1,2,3,4;

e_seq := 1, 2, 3, 4

> L := [1,2,3,4];

L := [1, 2, 3, 4]

> M := [4,3,2,1];

M := [4, 3, 2, 1]

> e_seq[3];

3

> L[3];

3

> M[3];

2

> S := {1, 2, 3, 4}:
> T := {2, 3, 4, 1}:
> addressof(S);

2418976

> addressof(T);

2418976

> s := series( sin(x), x );

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

> c := series( cos(x), x );

c := series(1-1/2*x^2+1/24*x^4+O(x^6),x,6)

> s+c;

(series(1*x-1/6*x^3+1/120*x^5+O(x^6),x,6))+(series(...

> whattype( s+c );

`+`

> sumo := series( s+c, x );

sumo := series(1+1*x-1/2*x^2-1/6*x^3+1/24*x^4+1/120...

> whattype( sumo );

series

> convert( sumo, polynom );

1+x-1/2*x^2-1/6*x^3+1/24*x^4+1/120*x^5

> whattype( % );

`+`

> series( sin(x^(1/3)), x, 3 );

x^(1/3)-1/6*x+1/120*x^(5/3)-1/5040*x^(7/3)+O(x^3)

> whattype( % );

`+`

> lprint( %% );

x^(1/3)-1/6*x+1/120*x^(5/3)-1/5040*x^(7/3)+O(x^3)

> series( sin(x), x);

series(1*x-1/6*x^3+1/120*x^5+O(x^6),x,6)

> lprint( % );

series(1*x-1/6*x^3+1/120*x^5+O(x^6),x,6)

> restart;
> x;

x

> xab12bang_this_is_a_simple_name;

xab12bang_this_is_a_simple_name

> `This is still a simple name: it just has weird characters in it@#&*:-)`;
`This is still a simple name: it just has weird cha...
> restart;
> x := T[3];

x := T[3]

> eval( T );

T

> T[5] := 7;

T[5] := 7

> eval( T );

TABLE([5 = 7])

> A := Matrix( 3, 3, (i,j)->i^(j-1) );

A := _rtable[5246512]

> lprint( A );
Matrix(3,3,{(1, 1) = 1, (1, 2) = 1, (1, 3) = 1, (2, 1) = 1, 
(2, 2) = 2, (2, 3) = 4, (3, 1) = 1, (3, 2) = 3, (3, 3) = 9},
datatype = anything,storage = rectangular,
order = Fortran_order,shape = [])
> A[1,2];

1

> B := Vector( 2, i->b[i] );

B := _rtable[5114756]

> C := Matrix( 2, 2, (i,j)->c[i,j] );

C := _rtable[12879060]

> adj := LinearAlgebra:-Adjoint( C );

adj := _rtable[13696836]

> dt := LinearAlgebra:-Determinant( C );

dt := c[1,1]*c[2,2]-c[1,2]*c[2,1]

С официального разрешения                    © 2002 Waterloo Maple, Inc

 
Hosted by uCoz