Hey guys Im working with this integral and I can´t get it right.
f2[x, y] = -(a^2)*NIntegrate[NIntegrate[
p*Exp[-I*p*(2*Pi/lambda)*(a/R)*Sqrt[(x^2 + y^2)]*
Cos[phi - ArcTan[y/x]]], {phi, (alfa0 -
ArcSin[d/(2*a*p)]), (alfa0 + ArcSin[d/(2*a*p)])}], {p, e, 1}]
The error message is
phi = -1. ArcSin[0.000333333/p] is not a valid limit of integration.
Why Mathematica doesnt like this limit of integration? Thanks a lot!
Thanks @george2079 I´ve seen that post before I writed this one and I didnt realize that I needed to put the things like this
i1[p_?NumericQ] := i1[p] = NIntegrate[ Exp[-Ip(2*Pi/lambda)*(a/R)Sqrt[(x^2 + y^2)] Cos[phi - ArcTan[y/x]]], {phi, (alfa0 - ArcSin[d/(2*a*p)]), (alfa0 + ArcSin[d/(2*a*p)])}]
i2[x_?NumericQ, y_?NumericQ] := i2[x, y] = NIntegrate[i1[p], {p, e, 1}]
Thanks to all!
(Dont know how to edit the equations to appear with colors and all that stuff sorry!)
NIntegraterequires that all quantities except the integration variables have numerical values. – bbgodfrey Oct 16 '15 at 18:53NIntegrate[NIntegrate[phi, {phi, 0, b}], {b, 0, 1}]and read this "If the symbolbin this example does not evaluate to a number, a warning message is generated and the integral is returned unevaluated". Correct use of NIntegrate:NIntegrate[phi, {phi, 0, 1}]– garej Oct 16 '15 at 18:53pshould be a number. – garej Oct 16 '15 at 19:03pis not defined is exactly the problem, because that innerNIntegraterequires both an integrand that evaluates to a number and limits that evaluate to a number. There are ways around this: defining the innerNintegrateusing a functiong[p_?NumericQ]might work. But pay attention to the other comments. – march Oct 16 '15 at 19:04