# Limits


```python
# Load module
from sympy import *
```


```python
# Define variable
x = symbols('x')
```

## Define Function $$f(x) = \frac{x^2}{x} - 1$$


```python
# Function f(x) = x^2 / x - 1
def f(x):
    return x**2 / x - 1
```

## Calculate $$\lim_{x \to 0} f(x)$$ $$=\lim_{x \to 0^+} (x-1)$$


```python
# Limit of f(x)
lim = Limit(f(x), x, 0)
lim
```




$\displaystyle \lim_{x \to 0^+}\left(x - 1\right)$




```python
# Do the limit
lim.doit()
```




$\displaystyle -1$



## Define Function $$g(x) = \frac{1}{x}$$


```python
# Function g(x) = 1/x
def g(x):
    return 1/x
```

## Calculate $$\lim_{x \to 0^+} g(x)$$


```python
# Do the limit at positive side
limit(g(x), x, 0, '+')
```




$\displaystyle \infty$



## Calculate $$\lim_{x \to 0^-} g(x)$$


```python
# Do the limit at negative side
limit(g(x), x, 0, '-')
```




$\displaystyle -\infty$



1f9dcf8fc9ff8cbf192bbbf5762d014b74037409
ipynb
Jupyter Notebook
limits.ipynb
ricoen/learn-math
fc84bc4d0dc353f8ccb3c52e36155069e9ca5af4
MIT
2021-11-30T10:05:29.000Z
2021-12-30T13:39:08.000Z
limits.ipynb
ricoen/learn-math
fc84bc4d0dc353f8ccb3c52e36155069e9ca5af4
MIT
limits.ipynb
ricoen/learn-math
fc84bc4d0dc353f8ccb3c52e36155069e9ca5af4
MIT
Qwen/Qwen-72B
1. YES
2. YES