p[m_, 
        i_] := (m^i)/(m + 1)^(i + 1)
Plot[p[10, i], {i, 0, 50}];
N[p[10, 100]]

pkoh[m_, i_] := (Exp[-m]*(m^i))/
        Factorial[i]
Plot[pkoh[10, i], {i, 0, 50},  
        PlotRange -> All];
N[pkoh[10, 50]]

rabi[n_, 
        t_] := (∑_(i = 0)^100)(p[n, 
              i]*(Sin[Sqrt[1 + i]*t])^2)

a = 
        Plot[rabi[10, t], {t, 0, 30},  PlotRange -> {All, {0, 1}},  
          PlotPoints -> 200];

b = 
        Plot[rabi[ .05, t], {t, 0, 30},  
          PlotRange -> {All, {0, 1}}];

Show[a, b];

rabikoh[n_, 
        t_] := (∑_(i = 0)^50)(pkoh[n, 
              i]*(Sin[Sqrt[1 + i]*t])^2)

c = 
        Plot[rabikoh[10, t], {t, 0, 30},  PlotRange -> {All, {0, 1}},  
          PlotPoints -> 200];

d1 = 
        Table[{t, rabi[0.2, t] + 0.1*Random[]}, {t, 0, 10,  
            0.1}];
d2 = 
        Table[{t, rabi[0.4, t] + 0.1*Random[]}, {t, 0, 10,  
            0.1}];

datenplot1 = ListPlot[d1];

datenplot2 = ListPlot[d2];

Export["Q:\lehre\QIV2008\uebungen\d1.dat", 
      d1]
Export["Q:\lehre\QIV2008\uebungen\d2.dat", d2]

<< Statistics`NonlinearFit`

res1 = 
      BestFitParameters /. 
        NonlinearRegress[d1, 
          a0*Sin[om*t]^2 + a1*Sin[om*Sqrt[2]*t]^2 + 
            a2*Sin[om*Sqrt[3]*t]^2, {t}, {a0, a1, a2, om}, 
          RegressionReport -> BestFitParameters]

res1[[1]][[2]]

fitplot1 = 
        Plot[res1[[1]][[2]]*
              Sin[res1[[4]][[2]]*
                    t]^2 + res1[[2]][[2]]*
              Sin[res1[[4]][[2]]*Sqrt[2]*
                    t]^2 + res1[[3]][[2]]*
              Sin[res1[[4]][[2]]*Sqrt[3]*t]^2, {t, 0, 
            10}];

Show[fitplot1,  datenplot1];

Plot[
        a0*Sin[om*t]^2 + a1*Sin[om*Sqrt[2]*t]^2 + a2*Sin[om*Sqrt[3]*t]^2, {t, 
          0, 10}] /. res1

res2 = 
      BestFitParameters /. 
        NonlinearRegress[d2, 
          a0*Sin[om*t]^2 + a1*Sin[om*Sqrt[2]*t]^2 + 
            a2*Sin[om*Sqrt[3]*t]^2, {t}, {a0, a1, a2, om}, 
          RegressionReport -> BestFitParameters]

fitplot2 = 
        Plot[res2[[1]][[2]]*
              Sin[res2[[4]][[2]]*
                    t]^2 + res2[[2]][[2]]*
              Sin[res2[[4]][[2]]*Sqrt[2]*
                    t]^2 + res2[[3]][[2]]*
              Sin[res2[[4]][[2]]*Sqrt[3]*t]^2, {t, 0, 
            10}];

Show[fitplot2,  datenplot2];

photon1 = 
      Table[{i, res1[[i + 1]][[2]]}, {i, 0, 
          2}]
photon2 = 
      Table[{i, res2[[i + 1]][[2]]}, {i, 0, 
          2}]
therm1 = 
      ListPlot[photon1, PlotJoined -> True, 
        PlotStyle -> {RGBColor[1, 0, 0]}]; 
    therm2 = ListPlot[photon2, PlotJoined -> True, 
        PlotStyle -> {RGBColor[0, 1, 0]}];

Show[therm1,  therm2];

Table[p[0.1, i], {i, 0, 2}]
Table[p[0.15, i], {i, 0, 2}]
Table[p[0.2, i], {i, 0, 2}]
Table[p[0.25, i], {i, 0, 2}]
Table[p[0.3, i], {i, 0, 2}]
Table[p[0.35, i], {i, 0, 2}]
Table[p[0.4, i], {i, 0, 2}]

BestFitParameters /. 
      NonlinearRegress[photon1, (m^i)/(m + 1)^(i + 1), {i}, {m}, 
        RegressionReport -> BestFitParameters]

BestFitParameters /. 
      NonlinearRegress[photon2, (m^i)/(m + 1)^(i + 1), {i}, {m}, 
        RegressionReport -> BestFitParameters]

sigmaZ = {{1, 0}, {0, -1}};
sigmaY = {{0, -I}, {I, 0}};
a = hq delta /2;
b = hq  omega Sqrt[n + 1] /2;
Simplify[Eigenvalues[a*sigmaZ + b*sigmaY]]

Simplify[Eigenvectors[a*sigmaZ + b*sigmaY]]

splitting1 = 
        Plot[{Eigenvalues[1*sigmaZ + b*sigmaY][[1]], Eigenvalues[
                1*sigmaZ + b*sigmaY][[2]]}, {b, -5, 5},  
          PlotPoints -> 100];