Aufgabe 1
(Zuweisung von Funktionen)

(* Zuweisung mit Doppelpunkt *)

b=1;
f[x_]=b*x;
g[x_]:=b*x;

f[2]
g[2]

b=2;
f[2]
g[2]

b=3;
f[2]
g[2]

Remove["Global`*"]

(* Zuweisung mit Unterstrich *)

b=2;
f[x]=b*x;
g[x_]=b*x;

f[x]
g[x]

f[2]
g[2]

Remove["Global`*"]

Aufgabe 2
(Lösung von Polynomen)

h[x_]:=x^5+3.5*x^4+6.5*x^3+8.5*x^2+18x+30

l=Solve[h[x]==0,x]

l[[1]]
l[[1,1]]
l[[1,1,2]]

h1[x_]:=x^3+0.5*x^2+6
h2[x_]:=x^2+3*x+5

h1[l[[1,1,2]]]
h1[l[[2,1,2]]]
h1[l[[3,1,2]]]
h1[l[[4,1,2]]]
h1[l[[5,1,2]]]

h1[x/.l[[1]]]

h1[x/.l]

h2[l[[1,1,2]]]
h2[l[[2,1,2]]]
h2[l[[3,1,2]]]
h2[l[[4,1,2]]]
h2[l[[5,1,2]]]

Expand[h1[x]*h2[x]]

Remove["Global`*"]

Aufgabe 4

f[x_]:=If[x<0,-1*(x+1)^2,If[x>0,(x+1)^2 ,0]]

Plot[f[x],{x,-2,2},PlotRange->All,PlotStyle->RGBColor[1,0,0]]

Remove["Global`*"]

Aufgabe 5
( Geometrische Reihe, ListPlot)

f1=Table[(n^2+1)/n^2,{n,10}]

ListPlot[f1,AxesOrigin->{0,0.8},PlotRange->{{0,10},{0.8,2}},PlotStyle->PointSize[0.017]]

ListPlot[f1,AxesOrigin->{0,0.8},PlotJoined->True,PlotRange->{{0,10},{0.8,2}},PlotStyle->PointSize[0.017]]

Remove["Global`*"]

Aufgabe 6
(Fourierreihe)

f[x_]:=4/Pi*(Sum[Sin[n*x]/n,{n,1,m}])

(*f[x_]:=4/Pi*(∑_(n=1)^m)((Sin[n*x])/n)*)

For[m=1,m≤10,m++,
g[m]=f[x];
Print[g[m]];
p[m]=Plot[g[m],{x,-4,4}]; Print[p[m]]]
Show[Table[p[m],{m,1,10}]]

Remove["Global`*"]

Aufgabe 7
(Logistische Abbildung)

r=1.5;
x[0]=0.0008;
x[1]=r*x[0]*(1-x[0]);
X={x[0],x[1]};
Z={{x[0],x[1]}};
Do[
x[n+1]=r*x[n]*(1-x[n]);
X=AppendTo[X,x[n+1]];
Z=AppendTo[Z,{x[n+1],x[n]}]
,{n,1,200}]

ListPlot[X,PlotRange->All]

ListPlot[Z,Axes->None,Frame->True,PlotRange->{{0,1},{0,1}}]

r=3.1;
x[0]=0.0008;
x[1]=r*x[0]*(1-x[0]);
X={x[0],x[1]};
Z={{x[0],x[1]}};
Do[
x[n+1]=r*x[n]*(1-x[n]);
X=AppendTo[X,x[n+1]];
Z=AppendTo[Z,{x[n+1],x[n]}]
,{n,1,50}]
ListPlot[X,PlotRange->All]
ListPlot[Z,Axes->None,Frame->True,PlotRange->{{0,1},{0,1}}]

ListPlot[X,PlotRange->All,PlotJoined->True]

r=3.5;
x[0]=0.0008;
x[1]=r*x[0]*(1-x[0]);
X={x[0],x[1]};
Z={{x[0],x[1]}};
Do[
x[n+1]=r*x[n]*(1-x[n]);
X=AppendTo[X,x[n+1]];
Z=AppendTo[Z,{x[n+1],x[n]}]
,{n,1,50}]
ListPlot[X,PlotRange->All]
ListPlot[Z,Axes->None,Frame->True,PlotRange->{{0,1},{0,1}}]
ListPlot[X,PlotRange->All,PlotJoined->True]

r=3.741;
x[0]=0.0008;
x[1]=r*x[0]*(1-x[0]);
X={x[0],x[1]};
Z={{x[0],x[1]}};
Do[
x[n+1]=r*x[n]*(1-x[n]);
X=AppendTo[X,x[n+1]];
Z=AppendTo[Z,{x[n+1],x[n]}]
,{n,1,200}]
ListPlot[X,PlotRange->All]
ListPlot[Z,Axes->None,Frame->True,PlotRange->{{0,1},{0,1}}]
ListPlot[X,PlotRange->All,PlotJoined->True]

r=3.9;
x[0]=0.0008;
x[1]=r*x[0]*(1-x[0]);
X={x[0],x[1]};
Z={{x[0],x[1]}};
Do[
x[n+1]=r*x[n]*(1-x[n]);
X=AppendTo[X,x[n+1]];
Z=AppendTo[Z,{x[n+1],x[n]}]
,{n,1,2000}]
ListPlot[X,PlotRange->All]
ListPlot[Z,Axes->None,Frame->True,PlotRange->{{0,1},{0,1}}]

(* Bifurkationsdiagramm *)