Calculate t-quantiles and $\chi^2$-quantiles

How are t-quantiles and $\chi^2$-quantiles actually calculated? I find it difficult to find a formula.

For example, the t-quantile for 0.975 and 50 degrees of freedom is approximately 2.

This is easy to find out if I look it up in a table or use software. But how is it calculated?

When I try to figure it out by searching, I always end up on a page describing that it has something to do with one's data set, but that must be something else than what I'm looking for, since the quantiles are always the same and has nothing to do with one's data set.

• Please see stackoverflow.com/q/27912412 for a discussion of the algorithms used for "qt" function (inverse t) in R, as well as related algorithms used in R and MATLAB. – Just_to_Answer Aug 5 '17 at 17:53
• For some reason, I can't make the formula on the page you linked to evaluate to approximately 2, when I insert the numbers related to my example. Could you show me how it is done? – A. Jakobsen Aug 5 '17 at 18:39
• If you are referring to using the qt function in R, its basic inputs are p and the df. So for example, qt(0.975, df=50) on the R console gives me 2.008559 – Just_to_Answer Aug 5 '17 at 18:52
• The wikipedia link en.wikipedia.org/wiki/… computations only apply for DF up to 4. For higher df, it will be insane (or impossible) to compute by hand. – Just_to_Answer Aug 5 '17 at 19:07
• But just in terms of checking for fun, for df=2, qt(0.975, df=2) gives 4.302653 matching up with 2*(.975-.5)*sqrt(2/(4*0.975*(1-0.975))) giving 4.302653 – Just_to_Answer Aug 5 '17 at 19:08

• Precisely. If there were simple formulas, publishers would not find the space for tables of t and chi-squared distributions. Even standard normal is not easy, maybe see my list of methods to evaluate $P(0 < Z < 1)$ here. – BruceET Aug 5 '17 at 19:10