Skip to content

Commit e0d80ff

Browse files
hagenwmgeier
authored andcommitted
DOC: math notations for mono sources
1 parent b19acf2 commit e0d80ff

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

doc/math-definitions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
\newcommand{\scalarprod}[2]{\left\langle#1,#2\right\rangle}
99
\renewcommand{\vec}[1]{\mathbf{#1}}
1010
\newcommand{\wc}{\frac{\omega}{c}}
11+
\newcommand{\w}{\omega}
12+
\newcommand{\x}{\vec{x}}
13+
\newcommand{\n}{\vec{n}}

sfs/mono/source.py

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Compute the sound field generated by a sound source.
22
3+
.. include:: math-definitions.rst
4+
35
.. plot::
46
:context: reset
57
@@ -31,7 +33,7 @@
3133

3234

3335
def point(omega, x0, n0, grid, c=None):
34-
"""Sound pressure of a point source.
36+
r"""Sound pressure of a point source.
3537
3638
Parameters
3739
----------
@@ -54,11 +56,9 @@ def point(omega, x0, n0, grid, c=None):
5456
5557
Notes
5658
-----
57-
::
59+
.. math::
5860
59-
1 e^(-j w/c |x-x0|)
60-
G(x-x0, w) = --- -----------------
61-
4pi |x-x0|
61+
G(\x-\x_0,\w) = \frac{1}{4\pi} \frac{\e{-\i\wc|\x-\x_0|}}{|\x-\x_0|}
6262
6363
Examples
6464
--------
@@ -188,11 +188,11 @@ def point_dipole(omega, x0, n0, grid, c=None):
188188
189189
Notes
190190
-----
191-
::
191+
.. math::
192192
193-
d 1 / iw 1 \ (x-x0) n0
194-
---- G(x-x0,w) = --- | ----- + ------- | ----------- e^(-i w/c |x-x0|)
195-
d ns 4pi \ c |x-x0| / |x-x0|^2
193+
G(\x-\x_0,\w) = \frac{1}{4\pi} \left(\i\wc + \frac{1}{|\x-\x_0|}\right)
194+
\frac{\scalarprod{\x-\x_0}{\n_\text{s}}}{|\x-\x_0|^2}
195+
\e{-\i\wc|\x-\x_0}
196196
197197
Examples
198198
--------
@@ -406,16 +406,15 @@ def point_image_sources(omega, x0, n0, grid, L, max_order, coeffs=None,
406406

407407

408408
def line(omega, x0, n0, grid, c=None):
409-
"""Line source parallel to the z-axis.
409+
r"""Line source parallel to the z-axis.
410410
411411
Note: third component of x0 is ignored.
412412
413413
Notes
414414
-----
415-
::
415+
.. math::
416416
417-
(2)
418-
G(x-x0, w) = -j/4 H0 (w/c |x-x0|)
417+
G(\x-\x_0,\w) = -\frac{\i}{4} \Hankel{2}{0}{\wc|\x-\x_0|}
419418
420419
Examples
421420
--------
@@ -486,17 +485,15 @@ def line_velocity(omega, x0, n0, grid, c=None):
486485

487486

488487
def line_dipole(omega, x0, n0, grid, c=None):
489-
"""Line source with dipole characteristics parallel to the z-axis.
488+
r"""Line source with dipole characteristics parallel to the z-axis.
490489
491490
Note: third component of x0 is ignored.
492491
493492
Notes
494493
-----
495-
::
496-
497-
(2)
498-
G(x-x0, w) = jk/4 H1 (w/c |x-x0|) cos(phi)
494+
.. math::
499495
496+
G(\x-\x_0,\w) = \frac{\i k}{4} \Hankel{2}{1}{\wc|\x-\x_0|} \cos{\phi}
500497
501498
"""
502499
k = util.wavenumber(omega, c)
@@ -577,7 +574,7 @@ def line_dirichlet_edge(omega, x0, grid, alpha=3/2*np.pi, Nc=None, c=None):
577574

578575

579576
def plane(omega, x0, n0, grid, c=None):
580-
"""Plane wave.
577+
r"""Plane wave.
581578
582579
Parameters
583580
----------
@@ -600,9 +597,9 @@ def plane(omega, x0, n0, grid, c=None):
600597
601598
Notes
602599
-----
603-
::
600+
.. math::
604601
605-
G(x, w) = e^(-i w/c n x)
602+
G(\x,\w) = \e{-\i\wc\n\x}
606603
607604
Examples
608605
--------
@@ -624,7 +621,7 @@ def plane(omega, x0, n0, grid, c=None):
624621

625622

626623
def plane_velocity(omega, x0, n0, grid, c=None):
627-
"""Velocity of a plane wave.
624+
r"""Velocity of a plane wave.
628625
629626
Parameters
630627
----------
@@ -647,9 +644,9 @@ def plane_velocity(omega, x0, n0, grid, c=None):
647644
648645
Notes
649646
-----
650-
::
647+
.. math::
651648
652-
V(x, w) = 1/(rho c) e^(-i w/c n x) n
649+
V(\x,\w) = \frac{1}{\rho c} \e{-\i\wc\n\x} \n
653650
654651
Examples
655652
--------
@@ -671,7 +668,7 @@ def plane_velocity(omega, x0, n0, grid, c=None):
671668

672669

673670
def plane_averaged_intensity(omega, x0, n0, grid, c=None):
674-
"""Averaged intensity of a plane wave.
671+
r"""Averaged intensity of a plane wave.
675672
676673
Parameters
677674
----------
@@ -694,9 +691,9 @@ def plane_averaged_intensity(omega, x0, n0, grid, c=None):
694691
695692
Notes
696693
-----
697-
::
694+
.. math::
698695
699-
I(x, w) = 1/(2 rho c) n
696+
I(\x,\w) = \frac{1}{2\rho c} \n
700697
701698
"""
702699
if c is None:

0 commit comments

Comments
 (0)