Easiest way to draw function with Euler's Number

386 Views Asked by At

What is the easiest way to draw a function like this one?$$\frac{1}{7}e^{-2x^2}(1-4x^2)$$ I calculated the roots $x=-1/2$, $x=1/2$ and limit which is equal to $0$
I can't just substitute some values like $f(0)\approx 0,15$ into the formula and draw it, can I?

1

There are 1 best solutions below

2
On BEST ANSWER

A good approach is to see what each factor does. The second factor $1 - 4x^2$ is a parabola opening down, and at $x = 0$ reaches its maximum $1$. The first factor takes everything and makes it smaller, unless $x$ is very close to $0$, in which case it just leaves it mostly unchanged.

So in you put these ideas together: you expect a parabola close to the origin, going to zero as $x$ moves away from $0$

enter image description here

A minimal version of the code to produce the graph above in Python

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-2, 2, num = 200)
y1 = np.exp(-2 * x**2)
y2 = 1 - 4 * x**2

plt.plot(x, y1)
plt.plot(x, y2)
plt.plot(x, y1 * y2)
plt.show()