@@ -127,9 +127,7 @@ def convolve_density(
127127
128128 This computes the causal wake potential:
129129
130- .. math::
131-
132- V(z_i) = \\ sum_{j>i} Q_j \\ cdot W(z_j - z_i) + \\ frac{1}{2} Q_i \\ cdot W(0)
130+ $$V(z_i) = \\ sum_{j>i} Q_j \\ cdot W(z_j - z_i) + \\ frac{1}{2} Q_i \\ cdot W(0)$$
133131
134132 where only particles ahead (larger z index) contribute to the wake
135133 felt by each particle. This is mathematically a correlation, not
@@ -342,69 +340,57 @@ def impedance(self, k: np.ndarray | float) -> np.ndarray | complex:
342340
343341 For a pseudomode wakefield defined for z ≤ 0:
344342
345- .. math::
346-
347- W(z) = A \\ cdot e^{dz} \\ cdot \\ sin(k_0 z + \\ phi)
343+ $$W(z) = A \\ cdot e^{dz} \\ cdot \\ sin(k_0 z + \\ phi)$$
348344
349345 The impedance is defined as:
350346
351- .. math::
352-
353- Z(k) = \\ frac{1}{c} \\ int_{-\\ infty}^{0} W(z) \\ cdot e^{-ikz} \\ , dz
347+ $$Z(k) = \\ frac{1}{c} \\ int_{-\\ infty}^{0} W(z) \\ cdot e^{-ikz} \\ , dz$$
354348
355349 **Derivation:**
356350
357351 Substituting the wakefield:
358352
359- .. math::
360-
361- Z(k) = \\ frac{A}{c} \\ int_{-\\ infty}^{0} e^{dz} \\ sin(k_0 z + \\ phi) e^{-ikz} \\ , dz
362-
363- Using :math:`\\ sin(\\ theta) = \\ frac{e^{i\\ theta} - e^{-i\\ theta}}{2i}`:
364-
365- .. math::
353+ $$Z(k) = \\ frac{A}{c} \\ int_{-\\ infty}^{0} e^{dz} \\ sin(k_0 z + \\ phi) e^{-ikz} \\ , dz$$
366354
367- Z(k) = \\ frac{A}{2ic} \\ left[
368- e^{i\\ phi} \\ int_{-\\ infty}^{0} e^{(d + i(k_0 - k))z} dz
369- - e^{-i\\ phi} \\ int_{-\\ infty}^{0} e^{(d - i(k_0 + k))z} dz
370- \\ right]
355+ Using $\\ sin(\\ theta) = \\ frac{e^{i\\ theta} - e^{-i\\ theta}}{2i}$:
371356
372- Since :math:`d > 0`, both integrals converge:
357+ $$Z(k) = \\ frac{A}{2ic} \\ left[
358+ e^{i\\ phi} \\ int_{-\\ infty}^{0} e^{(d + i(k_0 - k))z} dz
359+ - e^{-i\\ phi} \\ int_{-\\ infty}^{0} e^{(d - i(k_0 + k))z} dz
360+ \\ right]$$
373361
374- .. math: :
362+ Since $d > 0$, both integrals converge :
375363
376- \\ int_{-\\ infty}^{0} e^{az} dz = \\ frac{1}{a} \\ quad \\ text{for } \\ text{Re}(a) > 0
364+ $$ \\ int_{-\\ infty}^{0} e^{az} dz = \\ frac{1}{a} \\ quad \\ text{for } \\ text{Re}(a) > 0$$
377365
378366 Evaluating:
379367
380- .. math::
381-
382- Z(k) = \\ frac{A}{2ic} \\ left[
383- \\ frac{e^{i\\ phi}}{d + i(k_0 - k)}
384- - \\ frac{e^{-i\\ phi}}{d - i(k_0 + k)}
385- \\ right]
368+ $$Z(k) = \\ frac{A}{2ic} \\ left[
369+ \\ frac{e^{i\\ phi}}{d + i(k_0 - k)}
370+ - \\ frac{e^{-i\\ phi}}{d - i(k_0 + k)}
371+ \\ right]$$
386372
387373 **Mathematica verification:**
388374
389- .. code-block:: mathematica
390-
391- (* Define the wakefield and compute impedance numerically *)
392- W[z_, A_, d_, k0_, phi_] := A Exp[d z] Sin[k0 z + phi]
375+ ```mathematica
376+ (* Define the wakefield and compute impedance numerically *)
377+ W[z_, A_, d_, k0_, phi_] := A Exp[d z] Sin[k0 z + phi]
393378
394- (* Analytical result *)
395- Zanalytic[k_, A_, d_, k0_, phi_] :=
396- A/(2 I c) (Exp[I phi]/(d + I (k0 - k)) - Exp[-I phi]/(d - I (k0 + k)))
379+ (* Analytical result *)
380+ Zanalytic[k_, A_, d_, k0_, phi_] :=
381+ A/(2 I c) (Exp[I phi]/(d + I (k0 - k)) - Exp[-I phi]/(d - I (k0 + k)))
397382
398- (* Numerical integration (should match) *)
399- Znumeric[k_, A_, d_, k0_, phi_] :=
400- 1/c NIntegrate[W[z, A, d, k0, phi] Exp[-I k z], {z, -Infinity, 0}]
383+ (* Numerical integration (should match) *)
384+ Znumeric[k_, A_, d_, k0_, phi_] :=
385+ 1/c NIntegrate[W[z, A, d, k0, phi] Exp[-I k z], {z, -Infinity, 0}]
401386
402- (* Test with sample values *)
403- c = 299792458;
404- {A, d, k0, phi} = {1*^15, 1*^4, 1*^5, Pi/4};
405- ktest = 5*^4;
406- {Zanalytic[ktest, A, d, k0, phi], Znumeric[ktest, A, d, k0, phi]}
407- (* Both should give the same complex number *)
387+ (* Test with sample values *)
388+ c = 299792458;
389+ {A, d, k0, phi} = {1*^15, 1*^4, 1*^5, Pi/4};
390+ ktest = 5*^4;
391+ {Zanalytic[ktest, A, d, k0, phi], Znumeric[ktest, A, d, k0, phi]}
392+ (* Both should give the same complex number *)
393+ ```
408394
409395 Parameters
410396 ----------
@@ -455,9 +441,7 @@ class PseudomodeWakefield(WakefieldBase):
455441
456442 Models the longitudinal wakefield as:
457443
458- .. math::
459-
460- W(z) = \\ sum_i A_i \\ cdot e^{d_i \\ cdot z} \\ cdot \\ sin(k_i \\ cdot z + \\ phi_i)
444+ $$W(z) = \\ sum_i A_i \\ cdot e^{d_i \\ cdot z} \\ cdot \\ sin(k_i \\ cdot z + \\ phi_i)$$
461445
462446 This form is used to approximate short-range wakefields such as the
463447 resistive wall wake.
@@ -852,17 +836,14 @@ class ImpedanceWakefield(WakefieldBase):
852836
853837 Notes
854838 -----
855- The impedance Z(k) is related to the wakefield W(z) by:
839+ The wakefield W(z) is defined for z ≤ 0 (trailing particles), with W(z) = 0
840+ for z > 0 (causality). The impedance Z(k) is related to the wakefield by:
856841
857- .. math::
858-
859- Z(k) = \\ frac{1}{c} \\ int_0^{\\ infty} W(z) e^{-ikz} dz
842+ $$Z(k) = \\ frac{1}{c} \\ int_{-\\ infty}^{0} W(z) e^{-ikz} dz$$
860843
861844 And the inverse:
862845
863- .. math::
864-
865- W(z) = \\ frac{2c}{\\ pi} \\ int_0^{\\ infty} \\ text{Re}[Z(k)] \\ cos(kz) dk
846+ $$W(z) = \\ frac{2c}{\\ pi} \\ int_0^{\\ infty} \\ text{Re}[Z(k)] \\ cos(kz) dk \\ quad (z \\ le 0)$$
866847
867848 Examples
868849 --------
0 commit comments