This mathematical notation defines the epsilon-delta definition of a limit.
I have noticed that the majority of students find it challenging to feel this definition, which is crucial for calculus and real analysis. I'll make it easier for you to understand and feel by illustrating it graphically and by writing Python code.
Before we begin, i highly advise you to watch my Video to get a better understanding of the subject.
This simulation demonstrates the existence of the limit
This simulation demonstrates that the limit
import numpy as np
import matplotlib.pyplot as plt
Import required libraries to perform numerical, mathematical operations and draw the graph.
def f(x):
return x ** 2
When we call the definition f(x), it squares the value of x.
x_limit = 2
Define the limit point
delta_values = np.linspace(0.1, 2, 10)
It assigns delta values. Here, we want 10 numbers between 0.1 and 2 to be assigned as delta values. Actually, 2 is a large value for delta. For such a large delta value, the error rate will be high. Furthermore, if you find any delta value that doesn't satisfy the Epsilon-Delta definition, the limit does not exist.
x = np.linspace(1, 3, 400)
plt.plot(x, f(x), label='f(x) = x^2')
x = np.linspace(1, 3, 400)
This line creates an array of x values ranging from 1 to 3, consisting of 400 evenly spaced points. This array of x values will be used to plot the function. plt.plot(x, f(x), label='f(x) = x^2')
The line plots the function
for delta in delta_values:
x_range = np.linspace(x_limit - delta, x_limit + delta, 400)
epsilon = max(abs(f(x_range) - f(x_limit))) # Calculate epsilon based on function behavior
# Check if the limit point is inside the epsilon-delta band
if f(x_limit) - epsilon <= 5 <= f(x_limit) + epsilon:
color = 'grey'
label = f'Limit Exists for Δ = {delta:.2f}'
else:
color = 'red'
label = f'Limit Does Not Exist for Δ = {delta:.2f}'
plt.fill_between(x_range, f(x_limit) - epsilon, f(x_limit) + epsilon, color=color, alpha=0.2, label=label)
for delta in delta_values
This loop iterates through the range of delta values defined earlier. For each delta value, it will create a delta-epsilon band around the limit point. x_range = np.linspace(x_limit - delta, x_limit + delta, 400)
This line creates an array epsilon = max(abs(f(x_range) - f(x_limit)))
This line calculates the maximum difference if f(x_limit) - epsilon <= f(x_limit) <= f(x_limit) + epsilon
This line checks whether the limit exists or not. According to the Epsilon-Delta definition, plt.fill_between(x_range, f(x_limit) - epsilon, f(x_limit) + epsilon, color=color, alpha=0.2, label=label)
This line fills the area between
plt.xlabel('x')
plt.ylabel('f(x)')
plt.title('Epsilon-Delta Ratio for $f(x) = x^2$')
plt.legend()
plt.grid()
plt.show()
This section of code is for adding labels, a title, a legend, and displaying the plot. plt.xlabel('x')
This sets the label for the x-axis of the plot, indicating what the x-axis represents. plt.ylabel('f(x)')
This sets the label for the y-axis of the plot, indicating what the y-axis represents. plt.title('Epsilon-Delta Ratio for $f(x) = x^2$')
This sets the title of the plot. plt.legend()
This adds a legend to the plot. The legend helps identify different elements on the plot, such as the function curve and the shaded delta-epsilon bands. plt.grid()
This adds a grid to the plot. plt.show()
This displays the plot on the screen.