Solving an Integral Numerically

I have been trying to solve the integral equation below, but cant seem to find a way out of this. Can someone please help me out with suggestion?

$f(t)=\int_0^{\infty}\frac{K_1a(t)}{a(t)+K_2}\,dt$

where $K_1$ and $K_2$ are some constants and $a(t) = \frac{Q}{(4\pi Nt)^{3/2}}*\exp(-x^2/(4Nt))$.

Thank you so much

-
@0xFE : I would suggest that latex version will cause problem in taking this to notebook, so its better to be converted as Mathematica code or putting both. – Rorschach Feb 23 '14 at 6:31
This does not look like an integral equation. Please be more specific: what is the unknown function you are looking for? From the description above I can only conclude that it is f(t). Am I right? If I am not, then what? If I am, it is just a problem of calculating an integral. – Alexei Boulbitch Feb 24 '14 at 8:59
@Alexi Boulbitch, yes it is just an integral equation, but what I want is if anyone knows how to get a closed-form expression for f(t) (not necessarily numerical results). – user12553 Feb 24 '14 at 9:03
@user12553 Wikipedia states the following: "In mathematics, an integral equation is an equation in which an unknown function appears under an integral sign." This is not the case in your expression above. Thus, no, it is not an integral equation. – Alexei Boulbitch Feb 26 '14 at 9:18
@AlexeiBoulbitch it is an integral equation (wrt to t in this case), and I do have the clues now to solving it, thanks to the suggestions below. And thanks to you too – user12553 Feb 27 '14 at 8:11

Just some points:

1. $a$ is a function of $x$ and $t$. Hence $f$ as defined will be a function of $x$.,ie. $f(x)=\int_0^\infty g(x,t)\, dt$ where $g(x,t)$ is your integrand.
2. To numerically integrate (as question title asks &given function of Gaussian's[diffusion eqn soln]), $f(x)$ needs a numerical argument.
3. I am not sure what your ultimate aim is.

a[x_, t_, q_, n_] := q Exp[-x^2/(4 n t)]/(4 Pi n t)^(3/2);
f[x_, q_, n_, k1_, k2_] :=
k1 NIntegrate[a[x, t, q, n]/(k2 + a[x, t, q, n]), {t, 0, Infinity}]


Applying, e.g. visualingf:

Plot[f[x, 1, 1, 1, 1], {x, -1, 1}]


This may take variable time depending on arguments. I hope this facilitates your aims.

-
thanks for your answer. Yes the points you highlighted above are very correct and related to what I am working with. My aim is to obtain an explicit expression for the integral result and be able to plot it. The plot based on numerical integration looks quite good and seem to conform with the theory I am working on – user12553 Feb 24 '14 at 6:55
@user12553 ok...I believe (as your question title suggests) that you will need evaluate integral numerically (as is done above),i.e. as with Gaussian: no closed form. You can then choose how to deal with values of functions: tabulate, plot using mesh size of your choice, interpolate if you wish etc. Expert users may provide you more helpful advice, esp. re: numerical considerations. – ubpdqn Feb 24 '14 at 7:18

I tried a few random values for constants and it worked for me. Here are some things you might be doing wrong:

• Using N as a variable: N is a protected symbol. Use n
• Using Integrate instead of NIntegrate when you want a numerical answer
• Defining the integral as a function: You are using $t$ as the integration variable, not as a function parameter.
-
Yes I am using t as a variable and wish to retain it after integration so as to be able to plot the result as a function on a time line – user12553 Feb 23 '14 at 7:10

Does this help, first you replace your equation as,

Simplify[(k1*a[t])/(a[t] + k2) dt /. a[t] -> (Q/(4*Pi*N*t)^(3/2))*exp (-x^2/(4*N*t))]


(dt exp k1 Q x^2)/(-32 k2 [Pi]^(3/2) (N t)^(5/2) + exp Q x^2)

Now apply integral,

Integrate[ Simplify[-((dt exp k1 Q x^2)/(32 N \[Pi]^(3/2) t (N t)^(
3/2) (k2 - (exp Q x^2)/(32 N \[Pi]^(3/2) t (N t)^(3/2)))))], t]


$\frac{\text{dt} \exp ^{2/5} \text{k1} Q^{2/5} x^{4/5} \left(-\sqrt{5} \log \left(\exp ^{2/5} Q^{2/5} x^{4/5}+\left(1+\sqrt{5}\right) \pi ^{3/10} \sqrt[5]{\exp } \sqrt[5]{\text{k2}} \sqrt{N} \sqrt[5]{Q} \sqrt{t} x^{2/5}+4 \pi ^{3/5} \text{k2}^{2/5} N t\right)+\log \left(\exp ^{2/5} Q^{2/5} x^{4/5}+\left(1+\sqrt{5}\right) \pi ^{3/10} \sqrt[5]{\exp } \sqrt[5]{\text{k2}} \sqrt{N} \sqrt[5]{Q} \sqrt{t} x^{2/5}+4 \pi ^{3/5} \text{k2}^{2/5} N t\right)+\sqrt{5} \log \left(\exp ^{2/5} Q^{2/5} x^{4/5}-\left(\sqrt{5}-1\right) \pi ^{3/10} \sqrt[5]{\exp } \sqrt[5]{\text{k2}} \sqrt{N} \sqrt[5]{Q} \sqrt{t} x^{2/5}+4 \pi ^{3/5} \text{k2}^{2/5} N t\right)+\log \left(\exp ^{2/5} Q^{2/5} x^{4/5}-\left(\sqrt{5}-1\right) \pi ^{3/10} \sqrt[5]{\exp } \sqrt[5]{\text{k2}} \sqrt{N} \sqrt[5]{Q} \sqrt{t} x^{2/5}+4 \pi ^{3/5} \text{k2}^{2/5} N t\right)-4 \log \left(\sqrt[5]{\exp } \sqrt[5]{Q} x^{2/5}-2 \pi ^{3/10} \sqrt[5]{\text{k2}} \sqrt{N} \sqrt{t}\right)+2 \sqrt{10-2 \sqrt{5}} \tan ^{-1}\left(\frac{8 \pi ^{3/10} \sqrt[5]{\text{k2}} \sqrt{N} \sqrt{t}-\left(\sqrt{5}-1\right) \sqrt[5]{\exp } \sqrt[5]{Q} x^{2/5}}{\sqrt{2 \left(5+\sqrt{5}\right)} \sqrt[5]{\exp } \sqrt[5]{Q} x^{2/5}}\right)-2 \sqrt{2 \left(5+\sqrt{5}\right)} \tan ^{-1}\left(\frac{\left(1+\sqrt{5}\right) \sqrt[5]{\exp } \sqrt[5]{Q} x^{2/5}+8 \pi ^{3/10} \sqrt[5]{\text{k2}} \sqrt{N} \sqrt{t}}{\sqrt{10-2 \sqrt{5}} \sqrt[5]{\exp } \sqrt[5]{Q} x^{2/5}}\right)\right)}{40 \pi ^{3/5} \text{k2}^{2/5} N}$

-
Thanks a lot. I applied: Integrate[ Simplify[-((dt exp k1 Q x^2)/(32 N [Pi]^(3/2) t (N t)^(3/ 2) (k2 - (exp Q x^2)/(32 N [Pi]^(3/2) t (N t)^(3/2)))))], t] and got the answer ->dt exp k1 Q x^2 [Integral]1/(-32 k2 [Pi]^(3/2) (N t)^(5/2) + exp Q x^2) [DifferentialD]t this doesn't give the same answer as yours, I dont know why – user12553 Feb 23 '14 at 7:07
could be version mismatch or some subtle issue. I am getting what I have written. – Rorschach Feb 23 '14 at 7:15
Please are you using Mathematica 8 or Mathematica 9? cos I am using Mathematica 8 version – user12553 Feb 23 '14 at 7:22
mine is version 9. With version 8 I get -0.0056121 dt exp k1 Q x^2 \[Integral]1/( k2 t (N t)^(3/2) - 0.0056121 exp Q x^2) \[DifferentialD]t – Rorschach Feb 23 '14 at 7:27
I'm pretty sure that exp(...) should be Exp[...] instead. – Rahul Feb 23 '14 at 12:57