Wrong exponential using numpy?

30 Views Asked by At

The exponential $e^{-5^2/8}$ is supposed to give $0.04393693362$ but when using the following numpy code: print(np.exp((-5*5)/2*4.0)), I get "1.9287498479639178e-22". Can you figure out what is wrong? I have stared at this for an hour now :/

1

There are 1 best solutions below

1
On

You need to place brackets around 2*4.0. It's calculating $e^{-50}$ instead of $e^{-3.125}$.