Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.6K Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Passing a numerical solution of an integral to NIntegrate?

Posted 4 years ago

Hello everyone,

I am trying to integrate one function (integrand A) and subsequently use that result as part of the integrand (integrand B) for another integral that is to be numerically solved. When I integrate function A analytically, I achieve my goal no problem. But, when I try to numerically integrate function A and subsequently use that solution in the second integral, my numerical solution is wrong. I was wondering if someone could help me make the second approach (the fully numerical approach) work? Attached is my code and further explanation of the problem.

Alex

Attachments:
POSTED BY: Alex B

The first integral returns a function:

In[1]:= P = Integrate[b*(1 - c*g)*Exp[-a*u] + b*(1 - c*g)*g*(1 - Exp[-a*u]) - b*Exp[-a*u], {u, 50, t}]
Out[1]=-15.7623 + 13.5 E^(-0.03 t) + 0.255 t

Whereas the NIntegrate calculation returns a number:

In[2]:= P = NIntegrate[b*(1 - c*g)*Exp[-a*u] + b*(1 - c*g)*g*(1 - Exp[-a*u]) - b*Exp[-a*u], {u, 50, 1000}]
Out[2]:= 467.562

For this reason, your final numerical integration involving P are different from each other.

POSTED BY: Michael Harrison
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard