Symbolic integral returns zero but numerical integration gives nonzero result

2 replies · 2K views · last reply
JBD
Messages
15
Reaction score
1
As shown in the image below, I tried to integrate a large integral. However, the result is strange. According to the result, the integral is always zero whatever the values of w, h, L, P, S and k. However, when I try to put some "test values", the result is not zero.

test values: P=1,w=1,h=0.1,L=1,S=0,k=0.2

This is not consistent with ouput 1. So what's wrong with my first input?

Codes:
Integrate[P/((Sqrt[y^2 + L^2 + z^2]) ((S - y)^2 + P^2 + z^2))Cos[k (Sqrt[y^2 + L^2 + z^2] +
Sqrt[(S - y)^2 + P^2 + z^2])], {y, -w/2, w/2}, {z, -h, h}]
NIntegrate[1/((Sqrt[y^2 + 1^2 + z^2]) ((0 - y)^2 + 1^2 + z^2))Cos[0.2 (Sqrt[y^2 + 1^2 + z^2] +
Sqrt[(0 - y)^2 + 1^2 + z^2])], {y, -0.5, 0.5}, {z, -0.1, 0.1}]
NIntegrate[Cos[0.4 Sqrt[1 + y^2 + z^2]]/(1 + y^2 + z^2)^(3/2), {y, -0.5, 0.5}, {z, -0.1, 0.1}]
Mathematica notebook showing a double integral over y and z of P times cosine of k times a sum of square roots divided by a product of square roots, with output 0, then a numeric version with output 0.162902.
 
Attachments
  • Mathematica notebook showing a double integral over y and z of P times cosine of k times a sum of square roots divided by a product of square roots, with output 0, then a numeric version with output 0.162902.
    Problem.JPG
    20.8 KB · Views: 526
In the first integral, you probably have defined the values of k, S, P, w, L, and h earlier in your session. What were those values?
 
phyzguy said:
In the first integral, you probably have defined the values of k, S, P, w, L, and h earlier in your session. What were those values?
Thank you for commenting.
Someone already explained to me why the integral is zero. He showed me lots of graphs and it can be seen that the indefinite integral vanishes over the entire domain. However, near the origin, when the limits of integration are narrow and symmetric, the definite integral will be positive and not vanish.