Testing if a variable is in an expression

### 9.4.5 Testing if a variable is in an expression

The has command determines whether or not an expression contains a given variable.

- has takes two arguments:
  - expr, an expression.
  - x, the name of a variable.
- has(expr,x) returns 0 if expr does not contain x and the 1-based index of x in lname(expr) otherwise.

#### Examples

has(x*y*sin(x),y)

2 |  |  |  |  |  |  |  |  |  |

has(x*y*sin(x),z)

0 |  |  |  |  |  |  |  |  |  |