Function Repository Resource:

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

Contributed by: Paco Jain (Wolfram Research)
 ResourceFunction["QuadraticFunctionQ"][expr,var] returns True if expr is a quadratic function of the symbol var, and returns otherwise. ResourceFunction["QuadraticFunctionQ"][expr,{var1,var2, …}] returns True if expr is a quadratic function of each of the symbols vari, considered together, and returns False otherwise.

## Details and Options

If expr is of the form lhs==rhs, ResourceFunction["QuadraticFunctionQ"][expr, ] is equivalent to ResourceFunction["QuadraticFunctionQ"][lhs - rhs, ]
An expression is determined to be quadratic if and only if it is a PolynomialQ in the variable(s) of the second argument, has at least one term of cumulative order 2 and has no terms of cumulative order greater than 2.

## Examples

### Basic Examples (2)

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

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Test whether a given expression represents a quadratic function of a list of variables:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=

### Properties and Relations (3)

Variables listed in the second argument are considered together:

 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=

If high-order terms in expr do not explicitly vanish, QuadraticFunctionQ[expr, ] returns False:

 In[8]:=
 Out[8]=

Explicitly taking the cubic and quartic coefficients of the previous input to be zero yields True:

 In[9]:=
 Out[9]=

Expressions that lack an explicit quadratic term are not considered to be QuadraticFunctionQ:

 In[10]:=
 Out[10]=

## Requirements

Wolfram Language 11.3 (March 2018) or above

## Version History

• 1.0.0 – 20 March 2019