Wolfram Research

Function Repository Resource:

RationalFunctionQ

Source Notebook

Determine whether an expression represents a rational function of a given set of variables

Contributed by: Wolfram Staff

ResourceFunction["RationalFunctionQ"][expr,var]

returns True if expr is a rational function of the symbol var, and returns False otherwise.

ResourceFunction["RationalFunctionQ"][expr,{var1,var2, }]

returns True if expr is a rational function of each of the symbols vari and returns False otherwise.

Examples

Basic Examples

Test whether an expression represents a rational function of a given variable:

In[1]:=
ResourceFunction["RationalFunctionQ"][(x^2 + 1)/(x - a), x]
Out[1]=

Test a different expression:

In[2]:=
ResourceFunction["RationalFunctionQ"][x Exp[x] + 1, x]
Out[2]=

Test for rationality with respect to a list of variables:

In[3]:=
ResourceFunction["RationalFunctionQ"][(x^2 + 1) Log[y]/(x - a), {x}]
Out[3]=

Test another expression for rationality with respect to a list of variables:

In[4]:=
ResourceFunction[
 "RationalFunctionQ"][(x^2 + 1) Log[y]/(x - a), {x, y}]
Out[4]=

Test another expression for rationality with respect to a list of variables:

In[5]:=
ResourceFunction["RationalFunctionQ"][(x^2 y + y^3)/(x - y), {x, y}]
Out[5]=

Possible Issues

Expressions which are constant with respect to a variable are considered rational:

In[6]:=
ResourceFunction["RationalFunctionQ"][a Log[x], {y}]
Out[6]=
In[7]:=
ResourceFunction["RationalFunctionQ"][(x^2 + 1)/(x - a), {x, y}]
Out[7]=

Resource History

License Information