Basics of MuPAD

Brown University Applied Mathematics


Integration

Another easy and useful function of MuPad is integration . You can integrate with respect to any variable (even if previously not used). To make the same integral a definite integral, you can easily just add a few lines of code within the parenthesis of the function. MuPad also knows calculus and will follow the rules. The following code shows these properties:

eq:= x^4-3

int(eq,x)

int(eq,y)

diff(int(eq,x),x)

int(eq,x = 0..8) or int(eq,x,(0,8))

Notice that to define the integrating parameters, we can use the notation "x = 0..8". This directly translates to "where x is from 0 to 8."

Sometimes when you have a complicated integral, it is necessary to either simplify an answer or ignore some special cases that may occur (to avoid dividing by zero). Both of these actions can be executed by the command "simplify" and the parameter "IgnoreSpecialCases" or "assume(condition)". Recall that a command is a function that we will apply with parenthesis such as "solve(...)" and a parameter is a part of a command within the parenthesis that tells MuPad to do a certain task or follow a certain rule when executing the command.
problem1 := (x^3*sin(x*y/z))/(z^2)

int(problem1,x)

simplify(%)

Notice that the "simplify" function created a common denominator. Sometimes it makes your answer cleaner, other times it won't. It is usually worth a shot to try when you have a complicated answer to any function.
problem2 := x*ln(x-y)/2

int(problem2,x)

int(problem2,x,IgnoreSpecialCases)

int(problem2,x,assume(y = 0))

Notice in this case, we ended up with a conditional solution. This is great! MuPad is following the rules of mathematics. However, this can be very annoying, especially if some of the conditional answers are in the complex plane or don't have a solution (the empty set). The "IgnoreSpecialCases" parameter gives you a real answer and usually the most practical solution. If you know a physical condition that can't be broken (such that a time variable must be positive or zero), the "assume" parameter allows you to only solve for solutions within this condition.

Home

< Previous

Next >