This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Cumulative distribution function of the chi-square distribution

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.




stats::chisquareCDF(m) returns a procedure representing the cumulative distribution function

of the chi-square distribution with mean m > 0.

The procedure f := stats::chisquareCDF(m) can be called in the form f(x) with an arithmetical expression x. The return value of f(x) is either a floating-point number or a symbolic expression:

If x ≤ 0 can be decided, then f(x) returns 0. If x > 0 can be decided, then f(x) returns the value .

If x is a floating-point number and m can be converted to a positive floating-point number, then these values are returned as floating-point numbers. Otherwise, symbolic expressions are returned.

The function f reacts to properties of identifiers set via assume. If x is a symbolic expression with the property x ≤ 0 or x ≥ 0, the corresponding values are returned.

f(x) returns the symbolic call stats::chisquareCDF(m)(x)if neither x ≤ 0 nor x > 0 can be decided.

Numerical values for m are only accepted if they are real and positive.

Note that, for large m, exact results may be costly to compute. If floating-point values are desired, it is recommended to pass floating-point arguments x to f rather than to compute exact results f(x) and convert them via float. Cf. Example 4.

Environment Interactions

The function is sensitive to the environment variable DIGITS which determines the numerical working precision.


Example 1

We evaluate the cumulative distribution function with mean m = 2 at various points:

f := stats::chisquareCDF(2): 
f(-infinity), f(-3), f(1/2), f(0.5), f(PI), f(infinity)

delete f:

Example 2

If x is a symbolic object without properties, then it cannot be decided whether x ≥ 0 holds. A symbolic function call is returned:

f := stats::chisquareCDF(m):

With suitable properties, it can be decided whether x ≥ 0 holds. An explicit expression is returned:

assume(0 <= x):

For integer values of m, the special function igamma can be expressed in terms of more elementary functions:

m := 6:

m := 5:

unassume(x): delete f, m:

Example 3

We use a symbolic mean m:

f := stats::chisquareCDF(m):
f(3), f(3.0)

When a numerical value is assigned to m, the function f starts to produce numerical values:

m := PI:
f(3), f(3.0)

delete f, m:

Example 4

We consider a chi-square distribution with large mean m = 1000:

f := stats::chisquareCDF(1000):

For floating-point approximations, one should not compute an exact result and convert it via float. For large mean m, it is faster to pass a floating-point argument to f. The following call takes some time, because an exact computation of the huge integer gamma(m/2) = gamma(500) = 499! is involved:


The following call is much faster:


delete f:



The mean: an arithmetical expression representing a positive real value

Return Values


Was this topic helpful?