Question: Why is plotting my function giving a different value to evalf?

I have an issue where I believe the values given by evalf (I have independent verification), but the plot of the same function is incorrect. Specifically, g(a) plotted for a <=0 is correct, and incorrect for a > 0.

What am I doing wrong?


g:=(a)->int(exp(-(x^2-a)^2),x=0..infinity)
plot(g(a), a=-2..5) #I don't believe anything for a > 0

evalf(g(-1)) #I believe all of these values
                          0.2059311656
evalf(g(0))
                          0.9064024772
evalf(g(1))
                          0.9868660750

 

Mattthew

Please Wait...