Message Boards Message Boards

0
|
3626 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

NIntegrate Error?

Posted 11 years ago
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]
POSTED BY: Ryan Simone
3 Replies
Posted 11 years ago
 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".
POSTED BY: Bill Simpson
Just FYI, though the Clear function has no bearing on your quesiton, your 
Clear ["global'*"]

should be 
Clear ["Global'*"]
POSTED BY: David Reiss
David Reiss wrote:
should be
Clear ["Global'*"]
It would work better with a context mark, aka backtick:
Clear["Global`*"]
POSTED BY: Ilian Gachevski
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract