Einführung/ Introduction

1. Einführung/ Introduction

1. Einführung/ Introduction

0  	Frontend versus Kernel
1  	Operationen / Opérations

2 	Analysis / Analyse

2.1 	Plots ==> CM1
2.2 	Rekursiv programmieren (Pattern Maching) / Programmation récursive  ==> CM1
2.3 	Zeit messen / mesurer le temps  ==> CM1
2.4 	Ableiten / La derivée  ==> CM1
2.5 	Integral / L'intégrale  ==> CM1
2.6 	Differentialgleichung / Equation différentielle  ==> CM1
2.7 	Grenzwerte / Valeurs limites
2.8 	Potenzreihen / Séries de puissances
2.9 	Vektoranalysis / Analyse vectorielle

3	Nochmals Graphic / Encore une fois graphiques

3.1  Introduction

Plot[Exp[-x/5] Cos[x], {x, 0, 10  Pi}];

Plot[E^(-x/5) Cos[x], {x, 0, 10  Pi}];

Table[Sin[n x] x + n, {n, 0, 5}]

Evaluate[Table[Sin[n x] x + n, {n, 0, 5}]]

Plot[
        Evaluate[Evaluate[Table[Sin[n x] x + n, {n, 0, 5}]]], {x, 0, 
          10  Pi}];

ParametricPlot[{t - 3  Cos[t], 2 - 3 Sin[t]}, {t, 0, 
          5  Pi}];

points = {{0, 0}, {1, 2}, {1.5, 3.4}, {2, 8}, {4, 
          3.4}, {3, -1}, {6, 3}}

ListPlot[points, PlotStyle -> PointSize[0.02], 
        PlotLabel -> "King"];

Plot3D[
        Sin[x^2 + y^2] E^(-2 x^2 - 5  y^2) + x/20, {x, -Pi/2, 
          Pi/2}, {y, -Pi/2, Pi/2}];

Plot3D[
        Sin[x^2 + y^2] E^(-2 x^2 - 5  y^2) + x/20, {x, -Pi/2, 
          Pi/2}, {y, -Pi/2, Pi/2}, PlotPoints -> 100];

<< Graphics`Polyhedra`

Show[Polyhedron[Dodecahedron]]

Show[Polyhedron[GreatStellatedDodecahedron], 
      Polyhedron[Icosahedron, {2, 2, 2}, 0.8], 
      Polyhedron[Icosahedron, {-2, -2, 2}, 0.8]]

3.2  Some further plots

Plot[ArcSin[x],{x,-1,1}];

Plot[{ArcCos[x],Cos[x],x},{x,-1,Pi},AspectRatio->Automatic];

Plot[ArcTan[x],{x,-5,5},AspectRatio->Automatic];

Plot[ArcCot[x],{x,-5,5},AspectRatio->Automatic];

Plot[Cot[x],{x,-5,5}];

a= 0  ;
b=  2Pi ;
r[x_]:= x  ;

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= 0  ;
b=  2Pi ;
r[x_]:= Cos[x]  ;

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= 0  ;
b=  5Pi ;
r[x_]:= x-Floor[x] ;

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

Table[ParametricPlot[(x-Floor[x]){Cos[x],Sin[x]},{x,0,k},AspectRatio->Automatic],{k,1,40}];

a= 0  ;
b=  2Pi ;
r[x_]:= E^x ;

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= -4  ;
b=  Pi/2 ;
r[x_]:= E^x ;

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= 0.01  ;
b=  10 Pi ;
r[x_]:= Log[x];

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= 0  ;
b=  2 Pi ;
r[x_]:= 3+Sin[2.5 Cos[x]];

ParametricPlot[r[x]{Cos[x],Sin[x]},{x,a,b},AspectRatio->Automatic];

a= 0  ;
b=  2 Pi ;


ParametricPlot[{Cos[3x+4] Sin[x/2],Cos[3x+5] Cos[3/2 x]},{x,a,b},AspectRatio->Automatic];

ParametricPlot[{Cos[5x](1+ Sin[x]),Sin[5x] (1+ Cos[x])},{x,a,b},AspectRatio->Automatic];

ParametricPlot[{Cos[x]+Sin[5x]/3,Sin[x] +Cos[5x]/3},{x,a,b},AspectRatio->Automatic];

ParametricPlot3D[{Cos[x]+Sin[4x]/3,Sin[x] +Cos[4x]/3, x+Cos[z]},{x,a,b},{z,a,b},AspectRatio->Automatic];

ParametricPlot3D[{Cos[x] Sin[y],Cos[x] Cos[y],Sin[y]},{x,0,2Pi},{y,0,2Pi},AspectRatio->Automatic];

ParametricPlot3D[{Cos[x] Sin[y],Cos[x] Cos[y],Cos[y]},{x,0,2Pi},{y,0,2Pi},AspectRatio->Automatic];

ParametricPlot3D[{Cos[y] Sin[x],Cos[y] Cos[x],Cos[y]},{x,0,2Pi},{y,0,2Pi},AspectRatio->Automatic];

ParametricPlot3D[{Cos[y] Sin[x],Cos[y] Cos[x],Sin[y]},{x,0,2Pi},{y,0,2Pi},AspectRatio->Automatic];

4 	Nochmals Algebra / Algèbre encore une fois

4.1  Gleichungen / Equations

Solve[36  x^5 + 36  x^4 + 25  x^3 + 25  x^2 + 4  x + 4 == 0, 
      x]

Solve[36  x^5 + 36  x^4 + 25  x^3 + 25  x^2 + 4  x + 5 == 0, 
      x]

NSolve[36  x^5 + 36  x^4 + 25  x^3 + 25  x^2 + 4  x + 5 == 0, 
      x]

Solve[
      Pi x^5 + E x^4 + Sin[Pi/19] x^3 + 1/278  x^2 + 4.3  x + 5 == 0, 
      x]

NSolve[
      Pi x^5 + E x^4 + Sin[Pi/19] x^3 + 1/278  x^2 + 4.3  x + 5 == 0, 
      x]

Solve[{2  x^2 + 3  y - 4 == 0, x^2 - 3  y^2 == 1}, {x, 
        y}]

% // N

Solve[{2  x^2 + 3  y - 4 == 0   &&  
          x^2 - 3  y^2 == 1}, {x, y}]

NSolve[{2x^2+3y-4==0  && x^2-3y^2==1},{x,y}]

Systeme / Systèmes

gl1 = (2  x + 3  y == 4);
gl2 = (5  x - 6  y == -2);

Solve[{gl1, gl2}, {x, y}]

Solve[{5  x - 6  y == -2}, {x, y}]

Solve[{2  x + 3  y == 4, 5  x - 6  y == -2}, {x, y}]

NSolve[{2x+3y==4,5x-6y==-2},{x,y}]

4.2  Matrizen / Matrices

mA = {{-1, 2, 3}, {3, 4, 5}, {6, 7, 8}}

mA // MatrixForm

10 mA // MatrixForm

Transpose[mA] // MatrixForm

mA . mA // MatrixForm

Det[mA]

Inverse[mA]

Eigenvalues[mA]

% // N

% // Chop

Eigenvectors[mA]

% // N

% // Chop

Solve[mA . {x, y, z} == {a, b, c}, {x, y, z}]

Solve[
      a^2 b c (mA . mA) . {x, y, z} == {a^2, a + b, b c/a}, {x, 
        y, z}]

Solve[
        a^2 b c (mA . mA) . {x, y, z} == {a^2 b, a^2 + b, 
            b c/a}, {x, y, z}] // Simplify

Solve[
        a^2 b c (mA . mA) . {x, y, z} == {a^2 b, a^2 + b, 
            b c/a}, {x, y, z}] // ExpandAll

mB = {{1, 1, 0}, {3, 4, 5}, {5, 6, 5}};  Det[mB]

Solve[mB . {x, y, z} == {r, s, t}, {x, y, z}]

Reduce[mB . {x, y, z} == {r, s, t}, {x, y, z}]

Jacobi für Gleichungssysteme / Jacobi pour un système d'équations

Remove[A, mE, mM, m, y, x]

A[x_] := 
        Table[Table[1 - Sign[x + n - k]^2, {k, 1, 10}], {n, 1, 
            10}];
mM = 0.2  A[-1] + A[0] + 0.2  A[1];
0.2  A[-1] + A[0] + 0.2  A[1] // MatrixForm

mE = IdentityMatrix[10]; mE // MatrixForm

b = Transpose[{Range[10]}]

y[0] = Transpose[{Table[1, {k, 1, 10}]}]

mM - mE // MatrixForm

y[k_] := (b - (mM - mE) . y[k - 1])

y[0]

y[1]

Table[y[k], {k, 0, 20}] // MatrixForm

Jacobi für Matrizen / Jacobi pour des matrices

Remove[A, mE, mM, m, y, x]

A[x_] := 
        Table[Table[1 - Sign[x + n - k]^2, {k, 1, 10}], {n, 1, 
            10}];
mM = 0.2  A[-1] + A[0] + 0.2  A[1];
0.2  A[-1] + A[0] + 0.2  A[1] // MatrixForm

mE = IdentityMatrix[10]; mE // MatrixForm

b = mE; b // MatrixForm

y[0] = mE;  y[0] // MatrixForm

mM - mE // MatrixForm

y[k_] := (b - (mM - mE) . y[k - 1])

y[0]; y[0] // MatrixForm

y[1]; y[1] // MatrixForm

y[20]; y[20] // MatrixForm

y[20] // Chop // MatrixForm

Inverse[mM] // MatrixForm

mM . y[20] // Chop // Round // MatrixForm

4.3  Prime numbers

?PrimeQ

PrimeQ[13]

?*Prime*

Prime[3]

t=Table[Prime[n],{n,1,10000}]

{t[[500]],t[[501]]}

Table[t[[n+1]]-t[[n]]==2,{n,1,Length[t]-1}]

4.3  Ueber Quadratzahlen

Dreiersummen von Quadratzahlen: Suche Tripel von natürlichen Zahlen, deren Quadratsumme wieder eine Quadratzahl ist!

tabT1=Flatten[Table[Sqrt[n^2+m^2+k^2],{n,1,10},{m,1,10},{k,1,10}]];

tabT1a=Table[{j,IntegerQ[Flatten[Table[Sqrt[n^2+m^2+k^2],{m,1,10},{n,1,10},{k,1,10}]][[j]]]},{j,1,Length[tabT]}];

tabT2=Drop[Union[Table[If[IntegerQ[Flatten[Table[Sqrt[n^2+m^2+k^2],{m,1,10},{n,1,10},{k,1,10}]][[j]]],j,0],{j,1,Length[tabT1]}]],1];

tabT2=Drop[Union[Table[If[IntegerQ[Evaluate[tabT1[[j]]]],j,0],{j,1,Length[tabT1]}]],1];

tabT2a={12,38,74,102,111,126,134,153,159,186,216,252,256,308,314,332,337,364,371,378,500,513,519,522,526,553,557,566,582,634,656,704,731,73,774,816,852,950,995};

tabT3=Flatten[Table[{m,n,k},{m,1,10},{n,1,10},{k,1,10}],2];

Table[tabT3[[tabT2a[[j]]]],{j,1,Length[tabT2a]}]

An. 	Uebung / Excercice

1.===>  Output 
2. ===> Kommentar pro Linie / commentaire par ligne
3. ===> Porte-Feuille