Request of calculating mixed integral - from -Inf to k

1 view (last 30 days)
Hello,
I have a simple question, but i cannot solve it. I would like to evaluate the integral of the function:
f=exp(-x) between -Inf and k.
I tried to use quad and int, but I haven't succedded both because of the -Inf and the k.
Please, let me know how to tackle such a problem, knowing that k is a symbol.
Kind regards, Antonio

Accepted Answer

Walter Roberson
Walter Roberson on 12 Jan 2012
If k is a symbol, you will have to use the symbolic toolbox.
syms x k
int(exp(-x), x, -inf, k)
Hint: the answer is infinity unless k is -infinity
  3 Comments
Walter Roberson
Walter Roberson on 12 Jan 2012
At -inf, you have exp(-(-inf)) which is exp(inf) which is inf. Unless somewhere along the line you subtract off infinity, you are going to get infinity as your answer.
The indefinite integral of exp(-x) is -exp(-x) + C . You could let your C be 1 arbitrarily, giving you 1-exp(-x) like you were expecting. But apply that to the lower bound x = -inf and you get 1-exp(-(-inf)) there, which simplifies to 1-exp(inf); and then remember you are _subtracting_ that from whatever the upper bound is, so that -exp(inf) is going to switch to +exp(inf) which is +inf.
mortain Antonio
mortain Antonio on 13 Jan 2012
Dear Walter,
your explanation is precise and I feel stupid. Lot of time using software and forgot the use of pen and the basic math!
I guess, the paper has a mistake, in fact it shouldn't be -Inf but 0. Reading better the paper, the lower values of the integral was depending on the domain of the variable.
Thanks again for the matlab and maths lessons!
Cheers,
Antonio

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!