# Table is divided into several sheets when imported in excel

i wanted to calculate a Student-t table with

m =
Table[
NSolve[
Rationalize[
Integrate[PDF[StudentTDistribution[0, 1, df], x], {x, -a, a}] ==
Vertrauensintervall/100
], a, Reals
],
{df, 3, 30, 1},
{Vertrauensintervall, {80, 90, 95, 98, 99, 99.73}}
]


but when I export it now to Excel, I get 30 sheets of those 6 values each :(

How can I tell Mathematica, to put it all in one sheet? (bonus would be formatted with just the value, without the a -> )

• try a/.First@NSolve – george2079 Oct 3 '14 at 10:49

Export["matrix.csv", m[[All, All, 1, 1, 2]]]


should do the trick.

Your table can be generated much easier and considerably faster using

c = CDF[StudentTDistribution[0, 1, df], a] -
CDF[StudentTDistribution[0, 1, df], -a] // FullSimplify

m = Table[
a /. FindRoot[c == Vertrauensintervall/100., {a, 0.1}],
{df, 3, 30, 1},
{Vertrauensintervall, {80, 90, 95, 98, 99, 99.73}}
];


This exports to a single Excel sheet if you use:

Export["test.xls", m]


The CDF is the integrated PDF which Mathematica knows in algebraic form in the case of the StudentTDistribution. So, no need to integrate yourself.

• Thank you very much, i am a mathematica beginner, so it took me a while to even come up with my formula :) – Stephan Ketterer Oct 3 '14 at 11:08

You can also use the built-in function Quantile without having to use Solve or FindRoot.

m2 = Table[Quantile[StudentTDistribution[0, 1, df], (100 + Vertrauensintervall)/ 200.],
{df, 3, 30, 1}, {Vertrauensintervall, {80, 90, 95, 98, 99, 99.73}}];


The result is identical to the one you get using the method suggested by @Sjoerd (to the deafult tolerance of 10^(-10) )

Chop[Norm[m - m2]] === 0
(* True *)

Export["test.xls", m2]