Zurück zum Inhaltsverzeichnis

Kapitel 1

Einfache Berechnungen

> 1/3 + 1/7;

10/21

> evalf( 1/3 + 1/7);

.4761904762

> evalf(Pi, 50);

3.1415926535897932384626433832795028841971693993751...

> abs(2+3*I);

sqrt(13)

> (3+2*I)/(2-I);

4/5+7/5*I

Polynome

> factor(x^4+2*x^3-12*x^2-40*x-32);

(x-4)*(x+2)^3

> expand((x-1)^4);

x^4-4*x^3+6*x^2-4*x+1

> simplify( exp(x*log(y)) );

y^x

> simplify(sin(x)^2+cos(x)^2);

1

> expand( cos(4*x)+4*cos(2*x)+3, trig);

8*cos(x)^4

> combine(4*cos(x)^3, trig);

cos(3*x)+3*cos(x)

Lösung von Gleichungen

> solve( x^2-x=5, x);

1/2+1/2*sqrt(21), 1/2-1/2*sqrt(21)

> glsys:={ 2*x + 3*y + z = 1,

> x - y - z = 4,

> 3*x + 7*z = 5}:

> solve( glsys );

{z = -14/41, y = -49/41, x = 101/41}

> solve( {x^2+y^2=10, x^y=2}, {x,y} );

{y = ln(2)/RootOf(exp(_Z)^2*_Z^2+ln(2)^2-10*_Z^2), ...

> evalf(%);

{x = 1.270433346+0.*I, y = 2.895858960-0.*I}

> fsolve( {x^2+y^2=10, x^y=2}, {x,y} );

{x = 3.102449071, y = .6122170880}

> display({implicitplot(x^2+y^2=10,x=-4..4,y=-4..4,color=black),implicitplot(x^y=2,x=0.01..4,y=-4..4,color=black)},scaling=constrained);

[Maple Plot]

> fsolve( {x^2+y^2=10, x^y=2}, {x=0..1,y=-4..0} );

{x = .7973111450, y = -3.060113550}

Lineare Algebra

> A:=<<1,3>|<2,4>>;B:=<<w|x>,<y|z>>;

A := _rtable[32481812]

B := _rtable[32485220]

> A+B,A.B;

_rtable[32489396], _rtable[1442544]

> A^(-1),B^(-1);

_rtable[32491940], _rtable[32494204]

> glmat:=<<2|3|1>,<1|-1|1>,<3|0|7>>;

glmat := _rtable[32498340]

>

> glmat.<x,y,z> = <1,4,5>;

_rtable[32449772] = _rtable[32449852]

> <x,y,z> = glmat^(-1).<1,4,5>;

_rtable[32449932] = _rtable[32450012]

>

Limites, Summen und Produkte

> Limit( (sqrt(1+x)-1)/x, x=0)=limit( (sqrt(1+x)-1)/x, x=0);

Limit((sqrt(x+1)-1)/x,x = 0) = 1/2

> Limit(x!/x^x, x=infinity)=limit(x!/x^x, x=infinity);

Limit(x!/(x^x),x = infinity) = 0

> Sum(1/i^2,i=1..infinity)=sum(1/i^2,i=1..infinity);

Sum(1/(i^2),i = 1 .. infinity) = 1/6*Pi^2

> Product( 1+1/x^2, x=1..infinity )=product( 1+1/x^2, x=1..infinity );

Product(1+1/(x^2),x = 1 .. infinity) = sinh(Pi)/Pi

Differentiation, Integration

> diff((x-1) / (x^2+1), x);

1/(x^2+1)-2*(x-1)*x/((x^2+1)^2)

> simplify(%);

-(x^2-1-2*x)/((x^2+1)^2)

> diff( sin(x*y), x);

cos(x*y)*y

> int( 1/(1+x^3), x);

1/3*ln(x+1)-1/6*ln(x^2-x+1)+1/3*sqrt(3)*arctan(1/3*...

> int( sin(x^2), x=a..b);

1/2*sqrt(2)*sqrt(Pi)*FresnelS(sqrt(2)*b/(sqrt(Pi)))...

Differentialgleichungen

> dgl := diff(y(x),x) * y(x) * (1+x^2) = x;

dgl := diff(y(x),x)*y(x)*(x^2+1) = x

> dsolve( {dgl, y(0)=0 }, y(x));

y(x) = -sqrt(ln(x^2+1)), y(x) = sqrt(ln(x^2+1))

> dgl := (y(x)^2 -x) * D(y)(x) + x^2-y(x) =0;

dgl := (y(x)^2-x)*D(y)(x)+x^2-y(x) = 0

> dsolve( dgl, y(x),implicit);

1/3*x^3-x*y(x)+1/3*y(x)^3+_C1 = 0

Potenzreihen

> series( sin(x), x=0, 10);

series(1*x-1/6*x^3+1/120*x^5-1/5040*x^7+1/362880*x^...

> Order:=10:

> dgl := diff(y(x), x$2) + diff(y(x),x) + y(x) = x + sin(x);

dgl := diff(y(x),`$`(x,2))+diff(y(x),x)+y(x) = x+si...

> lsg := dsolve( {dgl, y(0)=0, D(y)(0)=0}, y(x), series);

lsg := y(x) = series(1/3*x^3-1/12*x^4-1/120*x^5+1/2...

Laplace- und Fourier Transformationen

> with(inttrans);

Warning, the name hilbert has been redefined

[addtable, fourier, fouriercos, fouriersin, hankel,...
[addtable, fourier, fouriercos, fouriersin, hankel,...

Laplace

> laplace( cos(t-a), t, s);

cos(a)*s/(s^2+1)+sin(a)/(s^2+1)

> invlaplace(%,s,t);

cos(t)*cos(a)+sin(t)*sin(a)

> combine(%, trig);

cos(-t+a)

Fourier

> alias(sigma=Heaviside):

> f:=sigma(t+1) - sigma(t-1);

f := sigma(t+1)-sigma(t-1)

> plot(f,t=-2..2);

[Maple Plot]

> g:=fourier(f,t,w);

g := exp(I*w)*(Pi*Dirac(w)-I/w)-exp(-I*w)*(Pi*Dirac...

> simplify(g);

2*sin(w)/w

> plot(g, w=-10..10);

[Maple Plot]

> invfourier(g,w,t); simplify(%);

1/2*sigma(t+1)-1/2*sigma(-t-1)-1/2*sigma(t-1)+1/2*s...

sigma(t+1)-sigma(t-1)

Vereinfachungen (simplify)

> limit(g, w=0);

2

> g1:=subs(Dirac(w)=0, g);

g1 := -I*exp(I*w)/w+I*exp(-I*w)/w

> simplify(g1);

2*sin(w)/w

> plot(g1, w=-10..10);

[Maple Plot]

> invfourier(g1,w,t); simplify(%);

1/2*sigma(t+1)-1/2*sigma(-t-1)-1/2*sigma(t-1)+1/2*s...

sigma(t+1)-sigma(t-1)

Interpolation, Approximation

Interpolation

> datax:=[seq(i,i=1..10)]:

> datay:=[seq(rand(10)(), i=1..10)]:

> dataxy:=zip( (x,y)->[x,y], datax, datay);

dataxy := [[1, 8], [2, 6], [3, 9], [4, 3], [5, 1], ...

> f:=interp(datax, datay, y);

f := -61/362880*y^9+341/40320*y^8-11269/60480*y^7+1...
f := -61/362880*y^9+341/40320*y^8-11269/60480*y^7+1...

Approximation

> with(numapprox);

[chebdeg, chebmult, chebpade, chebsort, chebyshev, ...
[chebdeg, chebmult, chebpade, chebsort, chebyshev, ...

> x0:=solve(x^2=Pi/2)[1];

x0 := 1/2*sqrt(2)*sqrt(Pi)

> f:=pade(tan(x^2), x=x0, [3,3]):

> evalf(normal(f));

6.*(535383547.3*x-112531313.1-453295812.2*x^2+10541...

> p1:=plot( tan(x^2), x=x0-.1..x0+.1, -10..10,style=point, color=black):

> p2:=plot(f, x=x0-.1..x0+.1, -10..10, color=red):

> with(plots):
display(p1,p2);

[Maple Plot]

Funktionen und Terme

> f:=x->(x+a)^2/sin(x);

f := proc (x) options operator, arrow; (x+a)^2/sin(...

> f(b);f(a);f(sin(Pi/2));f(f(3));

>

(b+a)^2/sin(b)

4*a^2/sin(a)

(1+a)^2/sin(1)

((3+a)^2/sin(3)+a)^2/sin((3+a)^2/sin(3))

>

Graphik

> plot(sin(x)*exp(1)^(-x/5), x=0..4*Pi);

[Maple Plot]

> plot3d(sin(x)*exp(1)^y, x=0..2*Pi, y=0..Pi, axes=boxed);

[Maple Plot]

Programmierung

> f:=proc(x::nonnegint)
option remember;
if x=0 then 0
elif x=1 then 1
else f(x-1)+f(x-2) fi
end:

> f(50);

12586269025

Zurück zum Inhaltsverzeichnis