Basics of MuPAD

Brown University Applied Mathematics


Partial Differentiation

Differentiating functions in MuPad is quite easy. You do not have to declare a letter as a variable, it automatically assumes it as one. A string of letters (or just one symbol or character) will be taken as independent variables by default, but by using parenthesis you can define dependent variables. The only tricky part here is making sure that you derive with respect to the correct variable. The reason this is called "partial differentiation" instead of just "differentiation" is because you can differentiate equations of more than one variable - for example if you had an equation that mapped position, depending on both time and temperature.

First we must define the equation to differentiate

function := x^2+3*x-2
x^2 + 3x - 2
Notice that if we differentiate it with respect x, or t we will obtain different results. This is because we have not told MuPAD that x depends on another variable such as t, so it assumes that x is the independent variable of the equation.
diff(function, x)
2x + 3
diff(function, t)
0
In most cases, you will want to define your equation more explicitly - instead of just x, we would write x(t). Notice that this time, MuPAD recognizes t as the independent variable of the equation.
function2 := x(t)^2+3*x(t)-2
x(t)2 + 3x(t) - 2
diff(function2, x)
0
diff(function2, t)

The power of MuPAD, however, is in the fact that you can perform these kinds of computations on very complicated equations, and even substitute in different values along the way
function3 := z(x,y)^4+sin(z(x,y))

diff(function3,x)

diff(%,y)

subs(%,[z(x,y) = x^2+y^2])

Home

< Previous

Next >