Copyright (C) 2010-2020 Luke Olson
Copyright (C) 2020 Andreas Kloeckner
Poisson Problem:
Potential due to point charge: $$ u(x,y) = -\frac{1}{2\pi}\ln(r) $$
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import math
import sympy as sym
sym.init_printing()
X = np.arange(-10, 10, 0.2)
Y = np.arange(-10, 10, 0.2)
X, Y = np.meshgrid(X, Y)
r = np.sqrt(X**2 + Y**2)
Z = -np.log(r)/(2*math.pi)
sx = sym.Symbol("x")
sy = sym.Symbol("y")
sr = sym.sqrt(sx**2 + sy**2)
ssol = sym.log(sr)
sym.simplify(sym.diff(ssol, sx, 2) + sym.diff(ssol, sy, 2))
fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(111, projection='3d')
#ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.coolwarm,
# linewidth=0, antialiased=False)
ax.plot_wireframe(X, Y, Z, linewidth=0.2)
#ax.set_zlim(-1.0, 1.0)
#plt.show()
<mpl_toolkits.mplot3d.art3d.Line3DCollection at 0x7f8af6335dd0>
Given $C\log(r)$ as the free-space Green's function, can we construct the solution to the PDE with a more general $f$?