Function Repository Resource:

# LinearFunctionQ

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

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

## Details and Options

If expr is of the form Equal[lhs,rhs], ResourceFunction["LinearFunctionQ"][expr,] is equivalent to ResourceFunction["LinearFunctionQ"][lhs-rhs,]

## Examples

### Basic Examples (2)

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

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

Test for linearity with respect to a list of variables:

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

### Scope (1)

Variables listed in the second argument are considered together in the test for linearity:

 In[6]:=
 Out[6]=

### Possible Issues (1)

Expressions that are constant with respect to a variable are not considered linear:

 In[7]:=
 Out[7]=
 In[8]:=
 Out[8]=

## Requirements

Wolfram Language 11.3 (March 2018) or above

## Version History

• 1.0.0 – 08 March 2019