Skip to content

Instantly share code, notes, and snippets.

@KitWallace
Created September 26, 2012 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KitWallace/3788136 to your computer and use it in GitHub Desktop.
Save KitWallace/3788136 to your computer and use it in GitHub Desktop.
Potential due to a current source and sink -
import math
def distance(x=0,y=0,z=0) :
return math.sqrt(x*x + y*y + z*z)
def monopole_potential(Io,sigma,r) :
""" compute the potential in volts at a distance r from a monopole current source
Io current in amp
sigma - conductivity in ohm-1 m-1
r distance in m
dimensionally of the equation is amp / (ohm-1 m-1 m) = amp ohm = volt
"""
return Io / (4 * math.pi * sigma * r )
# problem from Bioelectricity course Lecture 1 section 11
# 2 mA source and sink 1 mm apart in x direction
# resistivity is 100.5 ohm-cm
# what is potential at distance 10 mm from one source in the z direction (y= 0)
# using the MKS system
Io = 2E-3
r-source = 10E-3
d = 1E-3
r-sink = distance(d,0,r-source)
rho = 100.5 * 1.0E-2 # ohm-m
sigma = 1.0 / rho
phi-source = monopole_potential(Io,sigma,r-source)
phi-sink = monopole_potential(-Io,sigma,r-sink)
phi = phi-source + phi-sink
print r-source,r-sink,rho,phi-source,phi-sink,phi,"Volts"
@KitWallace
Copy link
Author

See Lecture 1 section 11 on the Coursera Bioelectricity course https://www.coursera.org/course/bioelectricity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment