# Electrostatic potential of an electric dipole

The following code produces a plot of the electrostatic potential of an electric dipole $\mathbf{p} = (qd, 0, 0)$ in the $(x,y)$ plane for $q=1.602\times 10^{-19}\;\mathrm{C}, d=1\;\mathrm{pm}$ using the point dipole approximation.

import numpy as np
import matplotlib.pyplot as plt

# Dipole charge (C), Permittivity of free space (F.m-1)
q, eps0 = 1.602e-19, 8.854e-12
# Dipole +q, -q distance (m) and a convenient combination of parameters
d = 1.e-12
k = 1/4/np.pi/eps0 * q * d

# Cartesian axis system with origin at the dipole (m)
X = np.linspace(-5e-11, 5e-11, 1000)
Y = X.copy()
X, Y = np.meshgrid(X, Y)

# Dipole electrostatic potential (V), using point dipole approximation
Phi = k * X / np.hypot(X, Y)**3

fig = plt.figure()
{"ft_lang_label":"__label__en","ft_lang_prob":0.56125814,"math_prob":0.99972945,"size":1014,"snap":"2023-40-2023-50","text_gpt3_token_len":336,"char_repetition_ratio":0.102970295,"word_repetition_ratio":0.0,"special_character_ratio":0.35502958,"punctuation_ratio":0.18061674,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9998882,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-10-05T01:54:06Z\",\"WARC-Record-ID\":\"<urn:uuid:9b606e53-5920-4804-82fb-ec1613bf65b1>\",\"Content-Length\":\"24712\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9fe1ff96-8d9a-41fd-a8ff-d9a694c8fb08>\",\"WARC-Concurrent-To\":\"<urn:uuid:572918dd-180c-4f17-96a8-7ba00ac0bf8b>\",\"WARC-IP-Address\":\"3.130.82.216\",\"WARC-Target-URI\":\"https://scipython.com/book/chapter-7-matplotlib/examples/electrostatic-potential-of-an-electric-dipole/\",\"WARC-Payload-Digest\":\"sha1:YPWLUDNWG5RENKGK2IWCELCOBGJTIT74\",\"WARC-Block-Digest\":\"sha1:K4DQ7JI5ADY6WTT5VNJML3W7WOPBWS2E\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233511717.69_warc_CC-MAIN-20231005012006-20231005042006-00654.warc.gz\"}"}