Request of calculating mixed integral - from -Inf to k

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 12 Gen 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 Commenti
Walter Roberson
Walter Roberson il 12 Gen 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 il 13 Gen 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

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by