I have a simple problem. First I define the value of variables, then I calculate the expression as the following:
Code 1:
a = 10^-6;
b = 10^-3;
c = 1;
d = 0.1;
s = -d Sqrt[b^2 + c^2];
Integrate[(w E^(-w/a))/(w - s), {w, 0, ∞}]
-3.744368975478385*10^43415
As you see the result is so large. But if I manually insert the value of s (-0.1) into the expression, I would get zero, which is is close to the correct answer:
Code 2:
a = 10^-6;
b = 10^-3;
c = 1;
d = 0.1;
s = -d Sqrt[b^2 + c^2];
Integrate[(w E^(-w/a))/(w + 0.1), {w, 0, ∞}]
0.
What is the problem with the first code?
d = 1/10
instead? Also, the exact value ofs
is very close to $-0.1$, but not exactly equal to that value. Why do you think yours is a valid substitution? $\endgroup$NIntegrate
, or if possible, solve exactly before plugging in inexact parameters (e.g., this works in the present caseBlock[{s}, Integrate[(w E^(-w/a))/(w - s), {w, 0, \[Infinity]}, Assumptions -> s < 0]]
). $\endgroup$