Zurück zum Inhaltsverzeichnis

Kapitel 3

Elementare Operationen

> restart:

> 2+3;

5

> 2 3; # * is missing

Error, unexpected number

> 2*3;

6

> 2^3;

8

> 1/2;

1/2

> 1/2+1/3;

5/6

> sqrt(2);

sqrt(2)

> evalf( sqrt(2) );

1.414213562

> evalf( sqrt(2), 60);

1.4142135623730950488016887242096980785696718753769...

symbolic calculcation, exact resulat

> sqrt(2) * sqrt(8) - 4;

0

numeric calculation

> evalf(sqrt(2))*evalf(sqrt(8))-4;

-.2e-8

Präzision

> Digits; # default is 10

10

> Digits:=50;

Digits := 50

> evalf(sqrt(2))*evalf(sqrt(8))-4;

.3e-48

> Digits:=10: # back to default

> 100!;

933262154439441526816992388562667004907159682643816...
933262154439441526816992388562667004907159682643816...

> evalf(100!,5);

.93326e158

>

> evalf(100!,20);

.93326215443944152682e158

> lg2:=log[2](256);

lg2 := ln(256)/ln(2)

> evalf(lg2); # numeric

7.999999999

> simplify(lg2); # symbolic

8

> sq2:=evalf(sqrt(2));

sq2 := 1.414213562

> evalf(1/sq2^2,50); # 40 digits are rubbish !

.50000000026381803913919991547705793946024635015556...

Zeichenketten (Strings)

> str1:="Maple hat Strings.";

str1 :=

> convert(str1,symbol);

`Maple hat Strings.`

> convert("abc",list);

[

> cat(%[]);

> convert("abc",'bytes');

[97, 98, 99]

> convert(%,'bytes');

> str1[7..9];str1[-8..-2];

>

> searchtext("stri",str1);

11

> SearchText("stri",str1);

0

> sort(["Eva","Adam","Abel","Kain","Noah","Lot","Moses"],(x,y)->is(x>y));

[

>

>

Komplexe Zahlen, Matrizen, elementare Statistik

Komplexe Zahlen

> -20 * I + 200 * I / (20 + 10 * I);

4-12*I

> abs(4-12*I); evalf(%);

4*sqrt(10)

12.64911064

Lineare Algebra

> mat1:=<< 1| 2| 3>,< 7|11|-3>>;

mat1 := _rtable[1655068]

> mat2:=<<0,-3,5>|<7,17,-1>>;

mat2 := _rtable[14732620]

> mat3:=mat1 . mat2;

mat3 := _rtable[15515788]

> 3*mat1;

_rtable[15517700]

> mat4:= mat2 . mat1 + <<1,0,0>|<0,1,0>|<0,0,1>>;

mat4 := _rtable[1568208]

> mat4^3;

_rtable[15524060]

> mat4^(-1);

_rtable[15526092]

> with(LinearAlgebra):

> Determinant(mat4);

4224

Statistik

> with(stats): with(describe):

> data:=[ 10.2, 9.9, 10, 9.95, 10, 10.1, 10.4, 9.3, 9.85, 10.05, 10.1 ];

data := [10.2, 9.9, 10, 9.95, 10, 10.1, 10.4, 9.3, ...

> mean(data);

9.986363636

> variance(data);

.6776859503e-1

> sqrt(%);

.2603240193

Zurück zum Inhaltsverzeichnis