Hi Iam trying to use Nintegrate but I keep getting an error. Can somone explain how I can use it correctly. THanks.
Clear ["global'*"]
Nc = 2.8*10^19;
nexact [\[Eta]c_] := NIntegrate[ Nc*(2/\[Sqrt]\[Pi])*(x^(1/2))/(1 + e^(x - \[Eta]c)), {x, 0, 20}]; nexact[1]
In[1]:= Nc = 2.8*10^19;
nexact[nc_] := NIntegrate[Nc*2/Sqrt[Pi]*(x^(1/2))/(1 + e^(x - nc)), {x, 0, 20}];
nexact[1]
During evaluation of In[1]:= NIntegrate::inumr: The integrand (3.15946*10^19 Sqrt[x])/(1+e^(-1+x)) has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,20}}. >>
Out[3]= NIntegrate[(Nc 2 Sqrt[x])/(Sqrt[\[Pi]] (1 + e^(x - 1))), {x, 0, 20}]
In[4]:= Nc = 2.8*10^19;
nexact[nc_] := NIntegrate[Nc*2/Sqrt[Pi]*(x^(1/2))/(1 + E^(x - nc)), {x, 0, 20}];
nexact[1]
Out[6]= 4.41179*10^19
Compare the two definitions of nexact character by character to find the difference.
See the suggestion I added to the end of the new features suggestion list yesterday and a much older suggestion I made earlier about “novice mode”.
dreiss
(David Reiss)
3
Just FYI, though the Clear function has no bearing on your quesiton, your
Clear ["global'*"]
should be
Clear ["Global'*"]
iliang
(Ilian Gachevski)
4
David Reiss wrote:
should be
Clear ["Global'*"]
It would work better with a context mark, aka backtick:
Clear["Global`*"]