Error in Mathematica

• Mathematica
All I'm saying is that they aren't the same. And you gave that expression when asked to reproduce the integral you where trying to evaluate.
This is confusing (at best).

Apparently I made a mistake when copying, it isn't important though. (The constant factor before NIntegrate shouldn't be there according to post #1, it shows up in #19 though)

Am I correct with saying ##GSS=100## and ##yQdB=1## since that would mean there's a problem with " 10 10^(1/10)" in the output.
I cannot reproduce the prefactor either (everything is off by a factor of 10)

Edit;
Can you post the exact code you're using right now once more?
That way I can safely assume the same constants are used and compare output.

All I'm saying is that they aren't the same. And you gave that expression when asked to reproduce the integral you where trying to evaluate.
This is confusing (at best).

Apparently I made a mistake when copying, it isn't important though. (The constant factor before NIntegrate shouldn't be there according to post #1, it shows up in #19 though)

Am I correct with saying ##GSS=100## and ##yQdB=1## since that would mean there's a problem with " 10 10^(1/10)" in the output.
I cannot reproduce the prefactor either (everything is off by a factor of 10)

Edit;
Can you post the exact code you're using right now once more?
That way I can safely assume the same constants are used and compare output.
I agree, it's confusing. I made a mistake. The code I'm using right now, including your line is

Code:
yp = 10^(5/10);
GSS = 100;
Cons = 10^-7;

For[yQdB = -10, yQdB <= 15, yQdB++;
yQ = 10^(yQdB/10);
A1 = 0.5*((GSS^2)*yQ )/yp*
NIntegrate[
1/x^2*Exp[(GSS*(x + GSS*yQ))/(x*yp) - x]*
ExpIntegralE[1, (GSS*(x + GSS*yQ))/(x*yp)], {x, Cons, Infinity},
PrecisionGoal -> 5, MaxRecursion -> 12];
Print["A1 = ", 0.5*((GSS^2)*yQ)/yp,
"\[Times] NIntegrate[  1/x^2\[Times]Exp[ ( ", GSS, "\[Times](x +",
GSS*yQ, "))/(x\[Times]", yp, ") - x]\[Times] ExpIntegralE[1, (",
GSS, "\[Times](x + ", GSS*yQ, "))/(x\[Times]", yp, ")]"]
]

Tom.G
Ref Post #18:
Copying equations works best through reply or quote.
Thanks, my bad. The confusion arose because the "PREVIEW..." button does not show the nicely formatted result; so I thought I'd try a different approach.
Next time I'll know.

Any hint?

I'll try to look at it tommorow, I recall getting "Null" results when I saved the results in a table.

OK, thanks. I'm trying to do the mathematical derivations all over again. But I suspect it's just a technical issue with Mathematica.

Hepth
Gold Member
Code:
For[yQdB = -10, yQdB <= 15, yQdB++;
yQ = 10^(yQdB/10);
INTEGRAND =
Simplify[1/x^2*Exp[(GSS*(x + GSS*yQ))/(x*yp) - x]*
Exp[-(GSS*(x + GSS*yQ))/(x*yp) T]/T];
A1 = 0.5*((GSS^2)*yQ)/yp*
NIntegrate[INTEGRAND, {T, 1, \[Infinity]}, {x, Cons, Infinity},
PrecisionGoal -> 5, MaxRecursion -> 12, WorkingPrecision -> 20];
Print["A1 = ", 0.5*((GSS^2)*yQ)/yp,
"\[Times] NIntegrate[  1/x^2\[Times]Exp[ ( ", GSS, "\[Times](x +",
GSS*yQ, "))/(x\[Times]", yp, ") - x]\[Times] ExpIntegralE[1, (",
GSS, "\[Times](x + ", GSS*yQ, "))/(x\[Times]", yp, ")]"]]
Try that.
Basically its evaluating E1 and the Exponential separately, and one is hitting $MaxNumber and the other$MinNumber.

To fix this I just took the definiton of the E1 function (its in its help file under "more information") and then let it combine the two exponentials before integration.

Now of course you have a 2-dimensional numerical integration, which takes a bit longer, but it seems to get the results. It complains about precision, but the results seem ok. You can increase working precision to try to get that error to go away, but it makes it slower and slower.

Does that help?

Thanks. But I get results in term of x. How to get numerical values? (I'm no expert in Mathematica)

Hepth
Gold Member
Code:
yp = 10^(5/10);
GSS = 100;
Cons = 10^-7;
results = {};
For[yQdB = -10, yQdB <= 15, yQdB++;
yQ = 10^(yQdB/10);
INTEGRAND =
Simplify[1/x^2*Exp[(GSS*(x + GSS*yQ))/(x*yp) - x]*
Exp[-(GSS*(x + GSS*yQ))/(x*yp) T]/T];
A1 = 0.5*((GSS^2)*yQ)/yp*
NIntegrate[INTEGRAND, {T, 1, \[Infinity]}, {x, Cons, Infinity},
PrecisionGoal -> 5, MaxRecursion -> 12, WorkingPrecision -> 20];
results = Join[results, {yQdB, A1}];
Print[{yQdB, A1}];]
Sorry, I left in your old code showing the equation.

This should print you real results, and at the end of the run you can just look at "results".

Though I'm not certain if this is giving the correct result to be honest, as once yQdB passes 5 it changes to something low. Maybe thats how it should be? I don't know.

EngWiPy
It's difficult to know if it's correct or not, as A1 is just one value from the final result. The final result is in the form of A1+A2-A3, where all values have similar integrad form approximately. I increased the working precision to 40 but I still get the "error" message!! When I combined all the results, I got some negative values. This shouldn't happen, as the final value must be between 0 and 0.5.