# Elliptic PDE: Illustrating the Maximum Principle

Copyright (C) 2010-2020 Luke Olson<br>
Copyright (C) 2020 Andreas Kloeckner

<details>
<summary>MIT License</summary>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
</details>


```python
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np

import sympy as sym
```

## Checking the Solution Symbolically


```python
sx = sym.Symbol("x")
sy = sym.Symbol("y")
sr = sym.sqrt(sx**2 + sy**2)
sphi = sym.atan2(sy, sx)
ssol = sr**2 * sym.cos(2*sphi)

sym.simplify(sym.diff(ssol, sx, 2) + sym.diff(ssol, sy, 2))
```




$\displaystyle 0$



## Plotting the Solution


```python
step = 0.04
maxval = 1.0

r = np.linspace(0, 1.25, 50)
p = np.linspace(0, 2*np.pi, 50)
R, P = np.meshgrid(r, p)
X, Y = R*np.cos(P), R*np.sin(P)

Z = R**2 * np.cos(2*P)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.YlGnBu_r,
                       linewidth=0, antialiased=False)
```

For the domain (and any given subdomain):
* Where are maximum and minimum attained?


```python

```

aaac9eb35e9c555bc8565748c58373b184a24e61
ipynb
Jupyter Notebook
demos/intro/Elliptic PDE Illustrating the Maximum Principle.ipynb
inducer/numpde-notes
80952b692fc16f185042a64d91312b0e53fafe17
Unlicense
2020-05-31T23:00:01.000Z
2021-12-25T15:08:14.000Z
demos/intro/Elliptic PDE Illustrating the Maximum Principle.ipynb
inducer/numpde-notes
80952b692fc16f185042a64d91312b0e53fafe17
Unlicense
demos/intro/Elliptic PDE Illustrating the Maximum Principle.ipynb
inducer/numpde-notes
80952b692fc16f185042a64d91312b0e53fafe17
Unlicense
2020-08-14T22:49:30.000Z
2021-12-25T15:08:34.000Z
Qwen/Qwen-72B
1. YES
2. YES