Scroll to Top

Virtual Math Learning Center

Virtual Math Learning Center Texas A&M University Virtual Math Learning Center

List Comprehension and Numerical, Graphical, and Symbolic Limits in Python

Author: David Manuel

In this video, it is explained how to use list comprehension in Python to numerically estimate a limit. The presenter also explains how to use Python to graphically estimate a limit and find the exact limit.

Transcript 07

Problem: Numerically estimate, graphically estimate, and evaluate exactly the following limit \[\displaystyle \lim_{x\rightarrow 1} \frac{\sqrt{x}-1}{x^3-1}\]

Python Code:
from sympy import *

x=symbols('x')
f=(sqrt(x)-1)/(x**3-1)
xval=[0.9,0.99,0.999,1.1,1.01,1.001,1.0001]
yval=[f.subs(x,i) for i in xval]
print(yval)
print('The limit appears to be about 1.6666')

matplotlib notebook

plot(f,(x,0,2))L=limit(f,x,1)print('The limit is',L)

L=limit(f,x,1,'-')
print('The left hand limit is',L)

L=limit(f,x,1,'+')
print('The right hand limit is',L)

Open Python Notebook File

See more videos from this section