0
$\begingroup$

I want to simulate the Fresnel diffraction and hence tried to define that function using NIntegrate. Even after using _?NumericQ it gives "evaluated to non numerical value error":

F[x_?NumericQ, ζ_?NumericQ] := NIntegrate[
  (Exp[ I*2000*(((0.006)^2 + ζ^2)^(0.5) + (20^2 + (x - ζ)^2)^(0.5))]
  ) / ((0.006)^2 + ζ^2)^(0.5) // Evaluate
, {ζ, -0.003, 0.003}
] // Evaluate

What's the way out?

$\endgroup$
4
$\begingroup$

You defined function F[x_?NumericQ, ζ_?NumericQ] but never passed x as numeric value. (you are using numerical integration after all). In addition, ζ is your integration variable. So this can not be a number you pass to integrate.

Try

f[x_?NumericQ]:=NIntegrate[(Exp[I*2000*(((0.006)^2+ζ^2)^(0.5)+
         (20^2+(x-ζ)^2)^(0.5))])/((0.006)^2+ζ^2)^(0.5),{ζ,-0.003,0.003}]

Now f[5] gives

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.