Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

 

Symbolic Math Toolbox 5.3

Calculus

This demo shows how to use the Symbolic Math Toolbox™ product with a simple example from calculus.

To manipulate a symbolic variable, create an object of type SYM.

x = sym('x')
x =

x

Once a symbolic variable is defined, you can use it to build functions. EZPLOT makes it easy to plot symbolic expressions.

f = 1/(5+4*cos(x))
ezplot(f)
f =

1/(4*cos(x) + 5)

Many functions can work with symbolic variables. For example, DIFF differentiates a function.

f1 = diff(f)
ezplot(f1)
f1 =

(4*sin(x))/(4*cos(x) + 5)^2

DIFF can also find the Nth derivative. Here is the second derivative.

f2 = diff(f,2)
ezplot(f2)
f2 =

(4*cos(x))/(4*cos(x) + 5)^2 + (32*sin(x)^2)/(4*cos(x) + 5)^3

INT integrates functions of symbolic variables. The following is an attempt to retrieve the original function by integrating the second derivative twice.

g = int(int(f2))
ezplot(g)
g =

-8/(tan(x/2)^2 + 9)

At first glance, the plots for f and g look the same. Look carefully, however, at their formulas and their ranges on the y-axis.

subplot(1,2,1)
ezplot(f)
subplot(1,2,2)
ezplot(g)

e is the difference between f and g. It has a complicated formula, but its graph looks like a constant.

e = f - g
subplot(1,1,1)
ezplot(e)
e =

8/(tan(x/2)^2 + 9) + 1/(4*cos(x) + 5)

To show that the difference really is a constant, simplify the equation. This confirms that the difference between them really is a constant.

e = simple(e)
ezplot(e)
e =

1

Contact sales
Free technical kit
Trial software
E-mail this page

Get Pricing and
Licensing Options