# numerical integration with non-numerical parameters [closed]

I want to integrate numerically. This is my question:

click to see my question

I used the following code:

   a = Integrate[
1/(x^2*(1 - ((3/
4)*((1/4)*Exp[24*(1 - x + (1/10))] - (1/(x - (1/10))^6))/
g) - (b/x)^2)^(1/2)), {x, 1.01/10, 100}]
c = Integrate[Sin[a], {g, 0, 10}]
d = Integrate[c^2, {b, 0, 10}]


but I got an error. How can I solve this problem?

best regards

• There is confusion here. NIntegrate is used for numerical integration not symbolic. I think, you should try Integrate instead if you want to keep the parameters b and g unassigned. – zhk Mar 9 '17 at 13:38
• @MapleSE-Area51Proposal thank you for your comment. I used this operator but mathematica couldn't solve it so I used NIntegrate. So there is no other way to keep the parameters b and g unassigned? – Hamed Peyrovedin Mar 9 '17 at 15:03
• a couple of comments, 1) do not use decimals for things that are exact fractions. 2) If you really want the {0,Infinity} integral mathematica can handle that and you generally get better performance if you don't try to trick it with finite bounds. 3) worry about the convergence issues before moving on the the generic parameter problem. – george2079 Mar 9 '17 at 15:11
• @george2079 Thank you very much for your comment. How can I handle the convergence issues? – Hamed Peyrovedin Mar 9 '17 at 15:51
• are those very small numbers (10^-19) actually important to the problem? Do your parameters have a known range? – george2079 Mar 9 '17 at 16:24

a[g_?NumericQ, b_?NumericQ] :=
NIntegrate[1/(x^2*(1 - ((3/4)*((1/4)*Exp[24*(1 - x + (1/10))] -
(1/(x - (1/10))^6))/g) - (b/x)^2)^(1/2)), {x, 101/1000,
100}, MaxRecursion -> 200]
c[b_?NumericQ] :=
NIntegrate[Sin[a[g, b]], {g, 0, 10}, MaxRecursion -> 200]


at this point c works. eg c[9]->1.74757 - 3.6566 I

now this should work:

d = NIntegrate[c[b]^2, {b, 0, 10}, MaxRecursion -> 200]


I suspect it will take a very long time. c takes ~10 seconds and figure several thousand evals, so several hours to a day.

errors messages of the sort "Numerical integration converging too slowly" I think can reasonably be ignored, but if you see "failed to converge" you should not trust the result.

• Thank you very much for your good answer. I will send the result here. – Hamed Peyrovedin Mar 10 '17 at 6:53
• The calculation of d worked quite well and took 2370 seconds and d= 116.828-381.946 I. – Akku14 Mar 10 '17 at 7:18

Are you looking for something like this?

intf[g_?NumericQ, b_?NumericQ] := NIntegrate[ 1/(x^2*(1 - (.75*(0.25*Exp[24*(1 - x
+ 10^(-19))] - (1/(x - 10^(-19))^6))/ g) -
(b/x)^2)^0.5), {x, 10^(-18), 100}]
intf[#, #] & /@ Range[1, 10]


Edit

Another way,

intf[b_, g_] :=  NIntegrate[..., {x, 0, Infinity}, AccuracyGoal -> 50]
intf[1, 2]
Plot3D[Re[intf[b, g]], {b, 0, 1}, {g, 0.1, 1}]


You should follow @george2079 comment, then this might give you THE desired output.

• I used your code but I got an error. I want to integrate the function to find a(b,g) . – Hamed Peyrovedin Mar 9 '17 at 15:04
• I edited my question. – Hamed Peyrovedin Mar 9 '17 at 17:52
• @HamedPeyrovedin Explain in your question, what exactly you want? – zhk Mar 9 '17 at 17:54
• I added my question photobox.co.uk/my/… – Hamed Peyrovedin Mar 9 '17 at 18:33