Symbolic Math Toolbox    

Creating Symbolic Variables and Expressions

The sym command lets you construct symbolic variables and expressions. For example, the commands

create a symbolic variable x that prints as x and a symbolic variable a that prints as alpha.

Suppose you want to use a symbolic variable to represent the golden ratio

The command

achieves this goal. Now you can perform various mathematical operations on rho. For example,

returns

Then

returns

Now suppose you want to study the quadratic function . The statement

assigns the symbolic expression to the variable f. Observe that in this case, the Symbolic Math Toolbox does not create variables corresponding to the terms of the expression, , , , and . To perform symbolic math operations (e.g., integration, differentiation, substitution, etc.) on f, you need to create the variables explicitly. You can do this by typing

or simply

In general, you can use sym or syms to create symbolic variables. We recommend you use syms because it requires less typing.


  Symbolic Objects Symbolic and Numeric Conversions