Skip to content

Commit

Permalink
DOC: math notations for mono sources
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored and mgeier committed Feb 18, 2019
1 parent b19acf2 commit e0d80ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
3 changes: 3 additions & 0 deletions doc/math-definitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@
\newcommand{\scalarprod}[2]{\left\langle#1,#2\right\rangle}
\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\wc}{\frac{\omega}{c}}
\newcommand{\w}{\omega}
\newcommand{\x}{\vec{x}}
\newcommand{\n}{\vec{n}}
51 changes: 24 additions & 27 deletions sfs/mono/source.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Compute the sound field generated by a sound source.
.. include:: math-definitions.rst
.. plot::
:context: reset
Expand Down Expand Up @@ -31,7 +33,7 @@


def point(omega, x0, n0, grid, c=None):
"""Sound pressure of a point source.
r"""Sound pressure of a point source.
Parameters
----------
Expand All @@ -54,11 +56,9 @@ def point(omega, x0, n0, grid, c=None):
Notes
-----
::
.. math::
1 e^(-j w/c |x-x0|)
G(x-x0, w) = --- -----------------
4pi |x-x0|
G(\x-\x_0,\w) = \frac{1}{4\pi} \frac{\e{-\i\wc|\x-\x_0|}}{|\x-\x_0|}
Examples
--------
Expand Down Expand Up @@ -188,11 +188,11 @@ def point_dipole(omega, x0, n0, grid, c=None):
Notes
-----
::
.. math::
d 1 / iw 1 \ (x-x0) n0
---- G(x-x0,w) = --- | ----- + ------- | ----------- e^(-i w/c |x-x0|)
d ns 4pi \ c |x-x0| / |x-x0|^2
G(\x-\x_0,\w) = \frac{1}{4\pi} \left(\i\wc + \frac{1}{|\x-\x_0|}\right)
\frac{\scalarprod{\x-\x_0}{\n_\text{s}}}{|\x-\x_0|^2}
\e{-\i\wc|\x-\x_0}
Examples
--------
Expand Down Expand Up @@ -406,16 +406,15 @@ def point_image_sources(omega, x0, n0, grid, L, max_order, coeffs=None,


def line(omega, x0, n0, grid, c=None):
"""Line source parallel to the z-axis.
r"""Line source parallel to the z-axis.
Note: third component of x0 is ignored.
Notes
-----
::
.. math::
(2)
G(x-x0, w) = -j/4 H0 (w/c |x-x0|)
G(\x-\x_0,\w) = -\frac{\i}{4} \Hankel{2}{0}{\wc|\x-\x_0|}
Examples
--------
Expand Down Expand Up @@ -486,17 +485,15 @@ def line_velocity(omega, x0, n0, grid, c=None):


def line_dipole(omega, x0, n0, grid, c=None):
"""Line source with dipole characteristics parallel to the z-axis.
r"""Line source with dipole characteristics parallel to the z-axis.
Note: third component of x0 is ignored.
Notes
-----
::
(2)
G(x-x0, w) = jk/4 H1 (w/c |x-x0|) cos(phi)
.. math::
G(\x-\x_0,\w) = \frac{\i k}{4} \Hankel{2}{1}{\wc|\x-\x_0|} \cos{\phi}
"""
k = util.wavenumber(omega, c)
Expand Down Expand Up @@ -577,7 +574,7 @@ def line_dirichlet_edge(omega, x0, grid, alpha=3/2*np.pi, Nc=None, c=None):


def plane(omega, x0, n0, grid, c=None):
"""Plane wave.
r"""Plane wave.
Parameters
----------
Expand All @@ -600,9 +597,9 @@ def plane(omega, x0, n0, grid, c=None):
Notes
-----
::
.. math::
G(x, w) = e^(-i w/c n x)
G(\x,\w) = \e{-\i\wc\n\x}
Examples
--------
Expand All @@ -624,7 +621,7 @@ def plane(omega, x0, n0, grid, c=None):


def plane_velocity(omega, x0, n0, grid, c=None):
"""Velocity of a plane wave.
r"""Velocity of a plane wave.
Parameters
----------
Expand All @@ -647,9 +644,9 @@ def plane_velocity(omega, x0, n0, grid, c=None):
Notes
-----
::
.. math::
V(x, w) = 1/(rho c) e^(-i w/c n x) n
V(\x,\w) = \frac{1}{\rho c} \e{-\i\wc\n\x} \n
Examples
--------
Expand All @@ -671,7 +668,7 @@ def plane_velocity(omega, x0, n0, grid, c=None):


def plane_averaged_intensity(omega, x0, n0, grid, c=None):
"""Averaged intensity of a plane wave.
r"""Averaged intensity of a plane wave.
Parameters
----------
Expand All @@ -694,9 +691,9 @@ def plane_averaged_intensity(omega, x0, n0, grid, c=None):
Notes
-----
::
.. math::
I(x, w) = 1/(2 rho c) n
I(\x,\w) = \frac{1}{2\rho c} \n
"""
if c is None:
Expand Down

0 comments on commit e0d80ff

Please sign in to comment.