# Counterexamples in Calculus

## At the Beginning
I tend to think that the demonstration of counterexamples should play an important role for teaching mathematics courses such as calculus, real analysis, functional analysis, etc. Among the goals of mathematics, the most important one may be to teach logical thinking. This can be thought via things like definition and theorems in mathematics. For this purpose, presentation of counterexamples is necessary. It explains why the hypotheses of various theorems are important, also simple counterexamples showing that the conclusion of a theorem may not hold once the hypotheses is violent. Further, counterexamples offer students the intuition and ability to recognize false propositions.  

Above are the motivations of starting this notebook to collect good counterexamples I have countered during my studying and teaching. 


```python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
```

## Differential Calculus
### If the derivative of a function $f(x)$ is positive at a point $x = x_0$, then there exists a neighborhood about $x = x_0$ where the function is increasing.

__Counterexample__ Considering function
\begin{equation}
    f(x) = \left\{\begin{array}{lc} x + 2x^2\sin\frac{1}{x}, & \text{if } x \neq 0 \\
    0,& \text{if } x = 0\end{array}\right.
\end{equation}
whose derivative is  
\begin{equation}
    f'(x) = \left\{\begin{array}{lc} 1 + 4x\sin\frac{1}{x}-2\cos\frac{1}{x}, & \text{if } x \neq 0 \\
    0,& \text{if } x = 0\end{array}\right..
\end{equation}
Clearly, $f'(0) > 0$, but $f(x)$ takes postive and negative values in any neihborhood of the point $x = 0$ (due to the $2\cos\frac{1}{x}$ term).  In other words, the function $f(x)$ is not monotone in any neihborhood of the point $x = 0$. 


```python
def fun(x):
    if (x == 0):
        return 0.
    else:
        return x + 2*x**2*np.sin(1/x)

def fun_x(x):
    if (x == 0):
        return 1.
    else:
        return 1 + 4*x*np.sin(1/x) - 2*np.cos(1/x)

x = np.linspace(-0.4, 0.4, 1001)
y = [fun(x[i]) for i in range(1001)]
fig, ax = plt.subplots(1,2)
ax[0].plot(x, y)
y = [fun_x(x[i]) for i in range(1001)]
ax[1].plot(x, y)
```

## Numerical Methods For Differential Equations
### The regularity of the domain plays an important role for the elliptic regularity for a Sobolve function
\begin{equation}
    \|u\|_{W^{2,p}(\Omega)} \leq \|\Delta u\|_{L^p(\Omega)}
\end{equation}
where $\Omega$ is $\mathcal{C}^{1,1}/\mathcal{C}^2$ or convex.  In other words, the Poisson equation $-\Delta u = f$ boundary value problem can get a regularity lifting of $2$ from the data $f$, i.e, the weak differentiability goes up by $2$.

__A counterexample in nonconvex domain:__ the regularity lifting is not true anymore. Consider in the Pacman domain $\Omega$ parametrized using polar coordinates:
\begin{equation}
    \Omega = \{(r,\theta): 0 < r < 1, 0 < \theta < \pi/\alpha\}
\end{equation}
with $1/2 < \alpha < 1$ then
\begin{equation}
    u = (1 - r^2)r^\alpha\sin(\alpha\theta)
\end{equation}
solves the homogeneous Dirichlet boundary problem:
\begin{align}
    -\Delta u & = (4\alpha + 4)r^\alpha\sin(\alpha\theta)\,\,\quad \text{in }\Omega \\
    u & = 0 \,\,\quad \text{on } \partial\Omega 
\end{align}
The right hand side data is in $L^p$, but $u \notin W^{2,p}$ for its second derivative shows strong singular behavior near the origin.  If we extend the Pacman to the full disk, such solution won't be there anymore for the value
\begin{equation}
    \lim\limits_{\theta\rightarrow 0^{+}}u(r,\theta) = \lim\limits_{\theta\rightarrow 2\pi^{-}} u(r,\theta)
\end{equation}




```python

```

9c4028e3e2548b6f17b0e80666008a9e73d04ef1
ipynb
Jupyter Notebook
Other/Examples_in_Calculus.ipynb
xiaozhouli/Jupyter
68d5a384dd939b3e8079da4470d6401d11b63a4c
MIT
2020-02-27T13:09:06.000Z
2021-11-14T09:50:30.000Z
Other/Examples_in_Calculus.ipynb
xiaozhouli/Jupyter
68d5a384dd939b3e8079da4470d6401d11b63a4c
MIT
Other/Examples_in_Calculus.ipynb
xiaozhouli/Jupyter
68d5a384dd939b3e8079da4470d6401d11b63a4c
MIT
2018-10-18T10:20:56.000Z
2021-09-24T08:09:27.000Z
Qwen/Qwen-72B
1. YES
2. YES