I'm trying to make a plot in LaTeX/tikz which is supposed to show the progressive critical value for a t distribution of arbitrary amount of degrees of freedom, in an animated plot, progressing over time.

For those with LaTeX that feel they need a little more insight on what I currently have, the code I have so far is included at the bottom of the question.

For this I wish to use a numerical approximation to actually calculate this critical value on the fly for each degree of freedom my plot is going through. I figured a good start would be to check out the student's t cumulative distribution function.


The above approximation (in GNUplot) works using the signum of x and the incomplete beta function. Sgn(x) is not too much of an issue to code, but I can't find anything on numerical approximations on the incomplete beta function.

So my first question is: is there any easier way to calculate the critical value progressing over time? Circumventing the need for complex numerical calculations will surely inhibit computation times.

I've read something on wolfram and on wikipedia, both pointing towards the hypergeometrical function. Approximating this is substantially more tedious, from what I understand. Unless there's a good way to approximate this instead?

Alternatively: how can approximate the ibeta function? The complete beta function, gamma function, etc. are all no problem.

Note: (1) I wish to avoid integrals because tikz cannot parse these numerically in a timely fashion (I wish to also display the critical value.) (2) preferrably I want an expression comprising of a taylor series, some expression with for instance gamma, etc. So preferrably something that won't involve making a huge table of calculations which I would retro-actively insert into tikz after the computations; this would contradict the versatility that I'm originally making this plot in TeX for.

PS: I'm not sure about the tags. I've just put some general direction of the right tags but I'm not too sure about the tags here in Mathematics.SX. Bear with me. :-)

          xlabel =$q$,
          ylabel =$d$,
          height=7cm, width=7cm,
          axis lines*=left,
          xmin = -6, xmax = 6,
          ymin = 0, ymax = .41,
          every y tick label/.append style  =
            { /pgf/number format/.cd,
               precision = 2, 
               fixed zerofill,
        \addplot+[mark={},very thick, draw=cyan!80] gnuplot[raw gnuplot] {%
           plot [-6:6][-6:6] gamma(.5*(\result+1))/(sqrt(\result*pi)*gamma(.5*\result))*((1+x^2/\result)^(-.5*(\result+1)))};
           \addlegendentry{df = $\pgfmathprintnumber[fixed,fixed zerofill, precision=0]{\result}$};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.