Green's function
==============

Fundamental solution
-------------------------------


```python
from sympy import *
init_printing()
```


```python
x1, x2, xi1, xi2 = symbols('x_1 x_2 xi_1 xi_2')
E = -1/(2*pi) * log(sqrt((x1-xi1)**2 + (x2-xi2)**2))
E
```

**Task**: Check that $\nabla^2_\xi E = 0$ for $x \neq \xi$.

*Hint*: https://docs.sympy.org/latest/tutorial/calculus.html#derivatives


```python
diff(E,x,2)
```

Directional derivative
------------------------------


```python
n1, n2 = symbols('n_1 n_2')
```

**Task**: Compute the directional derivative $\frac{\partial E}{\partial n}$.


```python

```

**Task** (optional): Write a function which returns the directional derivative of an expression.


```python
def ddn(expr):
    pass
```

Reflection principle
----------------------------

For simple geometries Green's function can sometimes be found by reflecting the fundamental solution at the boundary and linearly combining the fundamental solution with its reflection. 



**Task**: Based on $E$, find the solution for the half-space problem
\begin{align*}
    \nabla^2G(x,\xi) &= -\delta(x-\xi), & \xi\in\Omega \\
    G(x,\xi) &= 0, & \xi\in\partial\Omega \\
    \Omega &= \{\xi\in\mathbb{R}^2 : \xi_2 > 0\}
\end{align*}

*Hint*: https://docs.sympy.org/latest/tutorial/basic_operations.html#substitution


```python

```

**Task**: Based on $E$, find the solution for the half-space problem
\begin{align*}
    \nabla^2G(x,\xi) &= -\delta(x-\xi), & \xi\in\Omega \\
    \frac{\partial G(x,\xi)}{\partial n} &= 0, & \xi\in\partial\Omega \\
    \Omega &= \{\xi\in\mathbb{R}^2 : \xi_2 > 0\}
\end{align*}


```python

```

e7c7e6dcf67a50c061d8e3472839134570b4caca
ipynb
Jupyter Notebook
PythonCodes/Exercises/Class-SEAS/green/.ipynb_checkpoints/green-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
2020-02-25T08:05:13.000Z
2020-02-25T08:05:13.000Z
PythonCodes/Exercises/Class-SEAS/green/.ipynb_checkpoints/green-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
PythonCodes/Exercises/Class-SEAS/green/.ipynb_checkpoints/green-checkpoint.ipynb
Nicolucas/C-Scripts
2608df5c2e635ad16f422877ff440af69f98f960
MIT
Qwen/Qwen-72B
1. YES
2. YES