MATH/CMSC 206 - Introduction to Matlab

Announcements Syllabus Tutorial Projects Submitting

Symbolic Integration

Contents

Indefinite Integrals

Suppose you'd like to integrate the function 7/(1+x^2). Hmmm.... that reminds me of something I've seen before, but I can't recall the formula... Something about an inverse trig function... Ah, let's just ask Matlab:

int(7/(1 + x^2))
 
ans =
 
7*atan(x)
 

Oh, yeah -- that's it! Matlab uses atan for arctangent which is the same as inverse tangent.

Definite Integrals

Suppose we'd like to compute the area under the curve f(x) = x^3 + ln x over the interval where x is between 5 and 10. Just pass those end-points to the int command as two additional parameters:

int(x^3 + log(x), 5, 10)
 
ans =
 
5*log(20) + 9355/4
 

Self-Test

  1. Have Matlab integrate the function f(x) = sqrt(x^2 + 3). Aren't you glad we didn't ask you to do this one by hand?
  2. Have Matlab compute the definite integral of that same function over the interval [2, 4]. Ouch.

Answers to Self-Test

Next Topic: Numerical Integration