Einführung/ Introduction

1. Einführung/ Introduction

1. Einführung/ Introduction

0 	Frontend versus Kernel

Zellen / Cellules, éléments

Fenster / Fenêtres

Text

Text

1 	Operationen / Opérations

2 + 5

2*5

2 5

a b

ab

a*b

a = 2; b = 3;  a b

% + 2

Out[8] - 4

%% - 4

%5 - 4

3^1000

5 19.8 + 3^11 - Sin[1234456789 Pi]

5 19.8 + 3^15 - Sin[1234456789 Pi]

5 19/3^15 - Sin[1234456789 Pi]

Sin[7/6 Pi] + Sin[5 Pi/10]

Sin[Pi/4]+Sin[5 Pi/8]

N[%]

N[%%, 50]

Pi

Pi // N

N[Pi, 100000]

?a

Clear[a, b]

?a

a

Remove[a, b]

a

4 a  +  12 (a - b)  - Cos[Pi]

Simplify[4 a  +  12 (a - b)  - Cos[Pi]]

(a - b)^20

Expand[(a - b)^20]

u = (a + b + c)^10

Expand[u]

Timing[3^10000]

2 	Analysis / Analyse

2.1 	Plots

h[x_] := Cos[Sqrt[5  x + 5]]

Plot[h[x], {x, -1, 10}];

Plot[h[x], {x, -1, 20}];

Plot[h[x], {x, -1, 100}];

2.2 	Rekursiv programmieren (Pattern Maching) / Programmation récursive

fib[1] = 1; fib[2] = 1; fib[n_] := fib[n - 1] + fib[n - 2];  
    fib[20]

2.3 	Zeit messen / mesurer le temps

Timing[fib[20]]

f = Cos[Sqrt[5  x^2 + 5]]

D[f, x]

D[f, {x, 3}]

Timing[D[f, {x, 3}]]

2.4 	Ableiten / La derivée

D[Sin[x^2 - 4  x y^3 + y^4 y], y]

D[Sin[x^2 - 4  x y^3 + y^4 y], y, x]

2.5 	Integral / L'intégrale

Integrate[Sin[x], x]

Integrate[Sin[x^2], x]

Integrate[Sin[x y]^4, {x, a, b}]

Integrate[(x^20 - 4  x^4)/(x^2 - 20), x]

Integrate[(x^20 - 4  x^4)/(x^2 - 20), {x, 0, 1}]

% // N

2.6 	Differentialgleichung / Equation différentielle

res = 
      DSolve[y'[x]  -  2 y[x] == Cos[x], y[x], x]

res = DSolve[y'[x]  -  2 y[x] == Cos[x], y[x], 
          x]//Flatten

res = DSolve[y'[x]  -  2 y[x] == Cos[x], y[x], x] /. 
          C[1] -> 5//Flatten

new[x_] := y[x] /. res[[1]]

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

Plot[{new[x], h[x]}, {x, -1, 1}];

2.7 	Grenzwerte / Valeurs limites

Plot[x/E^x - 2, {x, 0, 20}];

Limit[x/E^x - 2, x -> Infinity]

Limit[x/E^x - 2, x -> -Infinity]

Plot[Sqrt[4  x + 5], {x, 0, 10}];

2.8 	Potenzreihen / Séries de puissances

Series[Sqrt[4  x + 5], {x, 0, 6}]

Plot[Sin[x^2]/x^3, {x, 0, 10}];

Series[Sin[x^2]/x^3, {x, 0, 10}]

Normal[%]

Residue[%%, {x, 0}]

2.9 	Vektoranalysis / Analyse vectorielle

Externes Package laden / Charger un package externe

<< Calculus`VectorAnalysis`

SetCoordinates [Cartesian]

Cartesian [x, y, z]

Gradient

Remove[f]

f  = Cos[x - y^2 - x y + z x^2 y]

Grad[f, Cartesian[x, y, z]]

Laplacian[f, Cartesian[x, y, z]]

Laplacian[f, Spherical[x, y, z]]

g = {3  x - y + 4  z,  Sqrt[x - y + z^2], x^2 - z y}

Div[g, Cartesian[x, y, z]]

Curl[g, Cartesian[x, y, z]]

SetCoordinates [Spherical]

CoordinatesToCartesian[{r, ϑ, φ}]

An. 	Uebung / Excercice

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

Work 1

5 + 9

2^39

2^4

Sin[1.5]

2^3 + 5

2^(3 + 5)

Plot[Sin[t], {t, 0, 2  Pi}];

hallo = 
      Plot[Sin[t], {t, 0, 2  Pi}, 
        DisplayFunction -> Identity]

Show[hallo]

Show[hallo, DisplayFunction -> $DisplayFunction]

First[hallo]

Nest[First, hallo, 4]

Map[
Line[{{#[[1]], 0}, #}], {{a, b}, {c, 
          d}}]

Map[
Line[{{#[[1]], 0}, #}] &, {{a, b}, {c, 
          d}}]

Show[
        Graphics[{
Thickness[
              0.001], 
Map[
Line[{{#[[1]], 0}, #}] &, 
              Nest[First, hallo, 4]
]
}], 
        Axes -> Automatic];

li = Table[{Random[], Random[]}, {n, 1, 10}]

ListPlot[li];

Table[Sin[x], {x, 1, 10}]

N[Table[Sin[x], {x, 1, 10}]]

Table[Sin[x], {x, 1, 10, 0.5}]

Table[Sin[x], {x, 1, 10, 1. }]

Table[Sin[x], {x, 1, 10, 1/2}]

{Sin[4], Sin[4. ]}

Table[{x, Sin[x]}, {x, 1, 10, 0.5}]

ListPlot[Table[{x, Sin[x]}, {x, 1, 10, 0.5}]]

ListPlot[Table[{x, Sin[x]}, {x, 0, 2 Pi, 0.1}]]

Do[Sin[x], {x, 0, 10}]

Do[Print[Sin[x]], {x, 0, 10}]

Sqrt[Print[Sin[x]]]

Do[ParametricPlot[{Sin[n t], Sin[(n + 1) t]}, {t, 0, 2  Pi}, 
        AspectRatio -> Automatic], {n, 0, 5}]

Plot[Sin[t], {t, 0, 15}];

Plot[Sin[t], {t, 0, 15},  Frame -> True];

Options[Plot]

SetOptions[Plot,  Frame -> True];
Plot[Sin[t], {t, 0, 15}];
SetOptions[Plot,  Frame -> False];

Plot[Sin[t], {t, 0, Pi/2}] // FullForm

Work 2

Remove["Global`*"]

5 + 9

5*9

5   9

5   9  +  4

5   (9  +  4)

5   / (9  +  4)

x (3  +  5)

x  -  7 x^2  +  4 x

(a -  b)/(a + b)

Sin[14/ 10 (2 + 3)] (6 - 2)

Sin[14/ 10 (2 + 3)] (6 - 2) // N

Sin[1.4 (2 + 3)] (6 - 2)

{1, 2, 3, 4, 5, 6}

{a, b, c, d, e, f, g}

{a, b, c, d, e, f, g, }

{Sin[1.2], Sin[1.3], Sin[1.4], Sin[1.5]}

Animate (in "Cell") !!

Do[Plot[Sin[n x], {x, 0, 2  Pi}], {n, 1, 3, 1/5}]

Sound!

Plot[Sin[x] x, {x, -12, 12}];

Play[
      Sin[x] x, {x, -12, 
        12}];

Play[Sin[1000 Sin[5.1 x] x], {x, -12, 12}];

Play[ 
        Sin[1000 x Sin[Pi/6 x]] (1 + Sin[122 x]/10), {x, 0, 
          15}];

Play[
        2 Sin[1000 x Sin[Pi/6 x] (1 + Sin[122 x]/10)], {x, 0, 
          20}];

Table[
      Play[ Sin[1000 x Sin[Pi/6 x]] n, {x, 0, 2  Pi}], {n, 0.1, 1, 
        0.2}]

Print!

Do[Print["Hallo Number ",  
        n, ", go out of my way!",  " Take number ",  2^n], {n, 1, 
        9}]

Others

Factor[x^24 - 1]

Table[
        Factor[x^n - 1], {n, 1, 24}]//MatrixForm

Table[Expand[(x - y)^n], {n, 1, 10}] // MatrixForm

D[1/(1 - x^4), x]

D[Cos[Tan[x]], x]

Integrate[1/(1 - x^4), x]

Integrate[1/(1 - x^4), x] // FullForm

Integrate[c, x]

f[x_] := Sin[x];
Integrate[f[x] -> 2  y, x -> y]

Table[Integrate[1/(1 - x^n), x], {n, 1, 5}] // 
      MatrixForm