WOLFRAM

gives True if expr is structurally a rational expression in x, and False otherwise.

RationalExpressionQ[expr,{x,y,}]

gives True if expr is structurally a rational expression in x,y,, and False otherwise.

RationalExpressionQ[expr,{x,y,},test]

gives True if expr is structurally a rational expression in x,y, with coefficients satisfying test, and False otherwise.

Details

  • A rational expression in x,y, is an expression constructed with x,y, and coefficients not containing x,y,, using Plus, Times and integer Power.
  • RationalExpressionQ[expr,vars,NumericQ] tests whether expr is a rational expression in vars with numeric coefficients.

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Test whether an expression is rational in the specified variable:

Out[1]=1
Out[2]=2

Test whether an expression is rational in the specified set of variables:

Out[1]=1
Out[2]=2

Test whether an expression is rational with numeric coefficients:

Out[1]=1
Out[2]=2

Scope  (4)Survey of the scope of standard use cases

Multilevel fractions are rational expressions:

Out[1]=1
Out[2]=2

Coefficients of rational expressions may involve arbitrary functions:

Out[1]=1

Variables need not be symbols:

Out[1]=1

Variables need not be independent of each other:

Out[1]=1

Properties & Relations  (2)Properties of the function, and connections to other functions

Together represents rational expressions as ratios of polynomials:

Out[1]=1
Out[2]=2
Out[3]=3

Use NumeratorDenominator to extract the numerator and the denominator:

Out[4]=4

Use PolynomialExpressionQ to verify that the resulting expressions are polynomials:

Out[5]=5

Rational expressions represent functions that are singular at zeros of the denominators:

Out[1]=1
Out[2]=2

Use FunctionSingularities to find the singularities:

Out[3]=3

Outside zeros of the denominators, rational expressions represent analytic functions:

Out[4]=4

Possible Issues  (3)Common pitfalls and unexpected behavior

A rational expression may not represent a rational function due to hidden division by zero:

Out[1]=1
Out[2]=2
Out[3]=3

A nonrational expression may represent a rational function:

Out[1]=1
Out[2]=2
Out[3]=3

RationalExpressionQ is purely syntactic:

Out[1]=1
Out[2]=2

Syntactically, Tan[x] is a coefficient, free of Sin[x] and Cos[x]:

Out[3]=3
Wolfram Research (2020), RationalExpressionQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RationalExpressionQ.html.
Wolfram Research (2020), RationalExpressionQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RationalExpressionQ.html.

Text

Wolfram Research (2020), RationalExpressionQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RationalExpressionQ.html.

Wolfram Research (2020), RationalExpressionQ, Wolfram Language function, https://reference.wolfram.com/language/ref/RationalExpressionQ.html.

CMS

Wolfram Language. 2020. "RationalExpressionQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RationalExpressionQ.html.

Wolfram Language. 2020. "RationalExpressionQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RationalExpressionQ.html.

APA

Wolfram Language. (2020). RationalExpressionQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RationalExpressionQ.html

Wolfram Language. (2020). RationalExpressionQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RationalExpressionQ.html

BibTeX

@misc{reference.wolfram_2025_rationalexpressionq, author="Wolfram Research", title="{RationalExpressionQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/RationalExpressionQ.html}", note=[Accessed: 23-May-2025 ]}

@misc{reference.wolfram_2025_rationalexpressionq, author="Wolfram Research", title="{RationalExpressionQ}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/RationalExpressionQ.html}", note=[Accessed: 23-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_rationalexpressionq, organization={Wolfram Research}, title={RationalExpressionQ}, year={2020}, url={https://reference.wolfram.com/language/ref/RationalExpressionQ.html}, note=[Accessed: 23-May-2025 ]}

@online{reference.wolfram_2025_rationalexpressionq, organization={Wolfram Research}, title={RationalExpressionQ}, year={2020}, url={https://reference.wolfram.com/language/ref/RationalExpressionQ.html}, note=[Accessed: 23-May-2025 ]}