(*	1 a  *)

(*	Kuvaus yksikkokiekossa: valitse jatkossa z0 sen sisalta	*)

M0[z_,z0_] := (z - z0)/(Conjugate[z0] z - 1);

?M0

(*	r-sateinen, origokeskinen ympyra	*)

r= 1/2;
ParametricPlot[{Re[r Exp[I theta]], Im[r Exp[I theta]]}, {theta, 0, 2 Pi}];

SetOptions[ParametricPlot, AspectRatio -> 1]

(*	Ympyra kuvattuna Mobiuksella *)

z0 = 0.5 I;
r = 1/2;
ParametricPlot[{Re[M0[ r Exp[I theta], z0]], Im[M0[r Exp[I theta],z0]]}, {theta, 0, 2 Pi}];

(*	Plotteja Mma:n koodipaketilla	*)

<<Graphics`ComplexMap`

CartesianMap[ Identity, {-5,5},{-5,5}];

PolarMap[ Identity, {0,1},{0,2 Pi}];

CartesianMap[Sqrt, {-5, 5}, {-5, 5}];

PolarMap[Sqrt, {0, 2}, {-Pi, Pi}];

M[z_] := M0[z,-I/2];
CartesianMap[ M, {-1,1},{-1,1}];

M[z_] := M0[z, .5 I];
PolarMap[ M, {0,1},{0,2 Pi}];

SetOptions[Graphics, AspectRatio -> 1, PlotRange -> {-1,1}]

M[z_] := M0[z, 1/2 + I/2];
PolarMap[ M, {0,1},{0,2 Pi}];

Options[PolarMap]

Inv[z_] := 1/z;
PolarMap[ Inv, {0.1,10},{0,2 Pi}];

Inv[z_] := 1/z;
CartesianMap[ Inv, {-2,2},{-2,2}];

Options[CartesianMap]

(*  1 b  *)

(* Mobius-kuvauksen inverssi matriisin kautta  *)

z0 = I/2;
m0 = {{1,-z0},{Conjugate[z0],-1}}

MatrixForm[%]

Inverse[m0]

Inverse[m0]  .  m0

M1[z_] :=  (4/3 z  -  2 I/3)/(-2 I/3 z  -  
            4/3)

?M1

M1[ M0[z, I/2] ]

Simplify[%]

(*  2  *) 

 (* 
      Kimurantti integraali *)

Integrate[1/(1 + 3 Cos[t]^2), t]

Plot[ -ArcTan[2 Cot[t]]/2, {t,0, 2 Pi}];

Integrate[1/(1 + 3 Cos[t]^2), {t, 0, 2 Pi}]

N[%]

Simplify[%14]

(*  3  *) 

 (*  Z - 
        muunnoksia *)

Sum[ 
      z^(-n) 2^n/Factorial[n  +  2],  {n, 0, Infinity}]

Sum[ z^(-n),  {n, 0,  Infinity, 3} ]

(*  4  *) 

 (*  Fibonaccin comeback *)

n =  110;
(5  +  Sqrt[5])/10 ((1  +  Sqrt[5])/2)^
          n  +  (5  -  Sqrt[5])/
          10 ((1  -  Sqrt[5])/2)^n

Simplify[%]

(*  5  *) 

 (*  Gibbsin ilmio *)

Osasumma1[x_, n_] := 
      4/Pi Sum[ 
          Sin[(2  m  +  1) x]/(2 m  +  1), {m, 0, 
            n}]

Plot[Osasumma1[x, 15], {x, - Pi, Pi}]

Osasumma2[x_,n_] := Pi + 2 Sum[ (-1)^(k - 1)/k Sin[k x], {k, 1, n} ]

Plot[Osasumma2[x, 15], {x, - Pi, Pi}]

Plot[ Pi + x - Osasumma2[x, 50], {x, -Pi, Pi}]

NIntegrate[ (Pi + x - Osasumma2[x, 50] )^2,  {x, -Pi, 
        Pi}]