Re: Mathematica Weirdness
- To: mathgroup at smc.vnet.net
- Subject: [mg116705] Re: Mathematica Weirdness
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 24 Feb 2011 06:24:30 -0500 (EST)
You need to use more precision
N[Integrate[1000000*Exp[x^2 - 12*x]*x^14, {x, 0, 1}], 20]
2.7482124237345664276
NIntegrate[1000000*Exp[x^2 - 12*x]*x^14, {x, 0, 1}]
2.74821
Bob Hanlon
---- Steve Heston <sheston at rhsmith.umd.edu> wrote:
=============
My question is why I get a negative integral of a positive
function?
Integrate[1000000*Exp[x^2-12*x]*x^14,{x,0,1}]//N
Integrate[1000000*Exp[x^2-12*x]*x^14,{x,0.,1}]//N
NIntegrate[1000000*Exp[x^2-12*x]*x^14,{x,0,1}]
The first line gives a negative answer, while the second two lines give
identical positive answers. Something is strange here.
Steve
Steven L. Heston
Associate Professor
Finance Department
Robert H. Smith School of Business
4447 Van Munching Hall Van Munching Hall
University of Maryland
College Park, MD 20742-1815
301-405-9686 TEL
301-405-0359 FAX
sheston at rhsmith.umd.edu
http://www.rhsmith.umd.edu