integration
显示 更早的评论
please can someone help me to solve this problem: I want to integrate this function:
exp(0.5*(1-((l-hm)/(2*H))-exp(-((l-hm)/(2*H)))))
I make this program:
hm=400;
H=50;
syms l;
H0=int(exp(0.5*(1-((l-hm)/(2*H))-exp(-((l-hm)/(2*H))))),l,hm,700)
but the answer is:
100*2^(1/2)*pi^(1/2)*exp(1)^(1/2)*(erf(2^(1/2)/2) - erf(2^(1/2)/(2*exp(3/2))))
how to get the right answer???
回答(3 个)
Alexander
2012-5-25
Why do you think that the answer is incorrect? If you just want a number, use double on the result:
>> double(H0)
ans =
209.1673
Or use INTEGRAL as Mike Hosea suggests.
2 个评论
Mike Hosea
2012-5-25
:lol: I didn't even bother with the symbolic attempt and completely misinterpreted the question. I'm blaming this on Walter. :)
Walter Roberson
2012-5-25
It's a fair cop, gov!
Mike Hosea
2012-5-25
I never quite know what to say when questions like this come up. There's nothing wrong with wanting to do integrals analytically, to be sure, and some times there are legitimate reasons, I guess, but I wonder what people need the analytical answer for. This problem is really no problem for INTEGRAL (or QUADGK)
>> integral(@(l)exp(0.5*(1-((l-hm)/(2*H))-exp(-((l-hm)/(2*H))))),hm,700)
ans =
2.091673274741571e+02
>> 100*2^(1/2)*pi^(1/2)*exp(1)^(1/2)*(erf(2^(1/2)/2) - erf(2^(1/2)/(2*exp(3/2))))
ans =
2.091673274741571e+02
Walter Roberson
2012-5-25
0 个投票
MuPAD is not able to complete that integral. (Maple is not able to do it either.)
Perhaps there is an appropriate change of variables, but I have not been able to locate one.
7 个评论
Alexander
2012-5-25
I believe the result is correct. Converting it to a double gives the same result as the numerical integration.
Why do you think that MuPAD cannot compute it?
Walter Roberson
2012-5-25
MuPAD's integration is much weaker than Maple's, so if Maple cannot integrate it then MuPAD almost certainly cannot (at least not without a lot of step by step work.)
The result you list might be correct, but I have not found a way to obtain it.
Mathematica is also not able to integrate it, at least within the default timeout of their free service,
http://www.wolframalpha.com/input/?i=integrate+exp%280.5*%281-%28%28l-400%29%2F%282*50%29%29-exp%28-%28%28l-400%29%2F%282*50%29%29%29%29%29+dl+l%3D400..700
Christopher Creutzig
2012-5-25
Walter, what do you mean, “MuPAD is not able to complete that integral”? It obviously is, Edward even showed the answer MuPAD returns. I have to agree with Alexander, the result seems to be completely correct.
Alexander
2012-5-25
Just to be sure, we are talking about the same thing: MuPAD does in fact give the above answer. It's also able to calculate the indefinite integral:
int(exp((1 - (l - 400)/(2*50) - exp(-(l - 400)/(2*50)))/2), l)
-100*2^(1/2)*PI^(1/2)*exp(1)^(1/2)*erf((2^(1/2)*exp(2)*exp(-l/200))/2)
This can be verified by differentiation.
Walter Roberson
2012-5-25
I think I misunderstood the original posting.
Christopher Creutzig
2012-5-25
If it helps to get some confidence in the result: To get integrals.com to integrate the expression (indefinitely), substitute x=exp(-l/200). http://integrals.wolfram.com/index.jsp?expr=-200*exp%285%2F2+-+%281%2F2%29*x^2*exp%284%29%29&random=false
Alexander
2012-5-25
Okay, that explains my confusion.
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!