Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.2K Views
|
12 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Some hard numerical integrations Specific example provided

Posted 10 years ago

Hi everyone, Let's suppose that there is a function, R(x), with variable x, and R(x)= ? P(x,t) dt. P(x,t) is a function of x and t, but it is a very complicated integral, so no analytic solution is available. Another function is H(x, y)= h(y)* ? R(x)*f(x) dx. Here, f(x) and h(y) are functions of x and y respectively. R(x) is calculated before. I need to plot the relation between H(x, y) and y. The bounds of both integrals are known. Does anyone know how to do it numerically in Mathematica? I hope that I make my question clear enough. Thanks for any help that you can provide!! Cheers, Stven

POSTED BY: Stven Maths
12 Replies
Posted 10 years ago

Thanks everyone for the informative reply. Very appreciated!!!

POSTED BY: Stven Maths

Begin by using ?NumericQ with NIntegrate. See (http://support.wolfram.com/kb/12502)

r[x_?NumericQ] := NIntegrate[p[x,t], {t,a,b}]

Where a and b are the limits of the numerical Integration.

POSTED BY: Sean Clarke

If you're looking for something maybe more efficient and more clever, you can turn R(x)= ? P(x,t) dt from an integral equation into a differential equation.

Now that it's a differential equation you can use NDSolve or ParametricNDSolve:

https://reference.wolfram.com/language/ref/NDSolve.html

https://reference.wolfram.com/language/ref/ParametricNDSolve.html

POSTED BY: Sean Clarke
Posted 10 years ago

Hi Sean,

First, thanks for your awesome reply. It seems to be a promising way. The only thing that worries me is that my equation is slightly different than the examples in NDSolve and ParametricNDSolve. I can convert my equation into a differential equation, but my differential equation is in the form of R'(x)= P(x,t), {t, t0, t1}. I think this is different from the form that can be calculated by NDSolve and PatametricNDSolve.

Regards,

Stven

POSTED BY: Updating Name

Use NIntegrate to compute r[x] (here I use Mathematica notation and avoid capitalizing user-defined function names). Compute the integral of r[x]*f[x] also with NIntegrate (possibly it should just be done as a double integral). At that point you are pretty much done.

I should remark that the subject header seems to be incorrect; I have not found a specific example anywhere in this.

POSTED BY: Daniel Lichtblau
Posted 10 years ago

Hi Daniel,

I apologize for the inappropriate subject header. Thanks for the reply!

Best regards,

Stven

POSTED BY: Stven Maths

Hi Stven,

you say you need the relation between H(x,y) and y. But H does not depend on x, because x is only a dummy variable of integration. Then you simply have H(y) = h(y)*const, with: $$\mbox{const} := \int\mbox{d}x \; f(x) \int \mbox{d}t \; P(x,t)$$ Regards -- Henrik

POSTED BY: Henrik Schachner
Posted 10 years ago
POSTED BY: Stven Maths
Posted 10 years ago
POSTED BY: Rene Samson
Posted 10 years ago
POSTED BY: Stven Maths
Posted 10 years ago
Attachments:
POSTED BY: Rene Samson
Posted 10 years ago

Hi Rene, Thanks so much for you very detailed reply!! Very appreciated. I am really busy recently, so I will follow your steps to do the calculation late today. Hope I won't get stuck. Thanks again! Best regards, Stven

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