symFunType

Name of the top-level function or operation of a symbolic expression.

Category: Symbolic Computations in MATLAB > Symbolic Variables, Expressions, Functions, and Preferences

Syntax

t = symFunType(S)

Returns the head of the expression S as a string.

Description

Every symbolic expression is a tree whose root is an operation or function. symFunType names that root, for example "times" for x*y and "sin" for sin(x), while a lone variable reports "variable". Together with children it lets a program walk an expression and branch on what it finds.

It answers the question of how an expression is built, whereas symType tells what kind of object it is.

Input arguments

S
Scalar symbolic expression.

Output arguments

t
String scalar such as "plus", "times", "sin" or "variable".

Example

Heads of some expressions

syms x y
symFunType(x*y)
symFunType(sin(x))
symFunType(x)
Output
ans = "times"
ans = "sin"
ans = "variable"

See also

symType children isSymType findSymType