pep8speaks: Hello @siddharth185! Thanks for submitting the PR.

 - In the file [`plasmapy/mathematics/mathematics.py`](https://github.com/PlasmaPy/PlasmaPy/blob/a19f915b468467cd9564f5417d5d38077ec4698a/plasmapy/mathematics/mathematics.py), following are the PEP8 issues :

> [Line 41:80](https://github.com/PlasmaPy/PlasmaPy/blob/a19f915b468467cd9564f5417d5d38077ec4698a/plasmapy/mathematics/mathematics.py#L41): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (82 > 79 characters)
> [Line 119:80](https://github.com/PlasmaPy/PlasmaPy/blob/a19f915b468467cd9564f5417d5d38077ec4698a/plasmapy/mathematics/mathematics.py#L119): [E501](https://duckduckgo.com/?q=pep8%20E501) line too long (87 > 79 characters)




StanczakDominik: As for the test failures... suddenly all the quantity docstrings seem to be failing, but @siddharth185 didn't change anything related to that. I checked on master at my own fork and well hello there, they're failing on master. This is looking like an @astropy change... I'm looking into it, because I think a potential change on their end may have fixed #135.
StanczakDominik: The newest changes on master should solve the docstring problem.
StanczakDominik: I'm pretty sure this can be merged after it's rebased on top of master! I'll make sure and merge it tonight.
StanczakDominik: Merging it. Thanks, @siddharth185 !
diff --git a/plasmapy/mathematics/mathematics.py b/plasmapy/mathematics/mathematics.py
index b20ed5e2..58c10e5f 100644
--- a/plasmapy/mathematics/mathematics.py
+++ b/plasmapy/mathematics/mathematics.py
@@ -3,6 +3,7 @@
 import numpy as np
 from scipy import special
 from astropy import units as u
+from scipy.special import wofz as Faddeeva_function
 
 
 def plasma_dispersion_func(zeta):
@@ -57,9 +58,9 @@ def plasma_dispersion_func(zeta):
     >>> plasma_dispersion_func(0)
     1.7724538509055159j
     >>> plasma_dispersion_func(1j)
-    0.7578721561413119j
+    0.757872156141312j
     >>> plasma_dispersion_func(-1.52+0.47j)
-    (0.6088888957234255+0.3349458388287403j)
+    (0.6088888957234254+0.33494583882874024j)
 
     """
 
@@ -79,7 +80,7 @@ def plasma_dispersion_func(zeta):
         raise ValueError("The argument to plasma_dispersion_function is "
                          "not finite.")
 
-    Z = 1j * np.sqrt(np.pi) * np.exp(-zeta**2) * (1.0 + special.erf(1j * zeta))
+    Z = 1j * np.sqrt(np.pi) * Faddeeva_function(zeta)
 
     return Z
 
@@ -124,9 +125,9 @@ def plasma_dispersion_func_deriv(zeta):
     >>> plasma_dispersion_func_deriv(0)
     (-2+0j)
     >>> plasma_dispersion_func_deriv(1j)
-    (-0.48425568771737626+0j)
+    (-0.48425568771737604+0j)
     >>> plasma_dispersion_func_deriv(-1.52+0.47j)
-    (0.1658713314982294+0.4458797880593507j)
+    (0.16587133149822897+0.44587978805935047j)
 
     """
 

Use Dawson function for dispersion
`plasma_dispersion_func` under `mathematics.py` currently uses `erf()` along with some other terms. This can be simplified to Dawson function, [dawsn](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.dawsn.html), and may even offer some minor speedups if scipy implements it in C code.
diff --git a/plasmapy/mathematics/tests/test_dispersion.py b/plasmapy/mathematics/tests/test_dispersion.py
index 9dabb8e6..1c7eb3ca 100644
--- a/plasmapy/mathematics/tests/test_dispersion.py
+++ b/plasmapy/mathematics/tests/test_dispersion.py
@@ -15,7 +15,7 @@
     (0, 1j * np.sqrt(π)),
     (1, -1.076_159_013_825_536_8 + 0.652_049_332_173_292_2j),
     (1j, 0.757_872_156_141_311_87j),
-    (1.2 + 4.4j, -0.054_246_146_372_377_471 + 0.207_960_589_336_958_13j),
+    (1.2 + 4.4j, -0.054_246_157_069_223_27+0.207_960_584_359_855_62j),
     (9.2j, plasma_dispersion_func(9.2j * units.dimensionless_unscaled)),
     (5.4 - 3.1j, -0.139_224_873_051_713_11 - 0.082_067_822_640_155_802j),
     (9.9 - 10j, 2.013_835_257_947_027_6 - 25.901_274_737_989_727j),

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.9
requirements/automated-code-tests.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astropy==6.0.1
astropy-iers-data==0.2025.3.31.0.36.18
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
coveralls==4.0.1
docopt==0.6.2
exceptiongroup==1.2.2
flake8==7.2.0
idna==3.10
iniconfig==2.1.0
mccabe==0.7.0
numpy==1.26.4
packaging==24.2
-e git+https://github.com/PlasmaPy/PlasmaPy.git@82eece6d5648641af1878f6846240dbf2a37a190#egg=plasmapy
pluggy==1.5.0
pycodestyle==2.13.0
pyerfa==2.0.1.5
pyflakes==3.3.2
pytest==8.3.5
PyYAML==6.0.2
requests==2.32.3
scipy==1.13.1
tomli==2.2.1
urllib3==2.3.0

name: PlasmaPy
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astropy==6.0.1
      - astropy-iers-data==0.2025.3.31.0.36.18
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - coverage==7.8.0
      - coveralls==4.0.1
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - idna==3.10
      - iniconfig==2.1.0
      - mccabe==0.7.0
      - numpy==1.26.4
      - packaging==24.2
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyerfa==2.0.1.5
      - pyflakes==3.3.2
      - pytest==8.3.5
      - pyyaml==6.0.2
      - requests==2.32.3
      - scipy==1.13.1
      - tomli==2.2.1
      - urllib3==2.3.0
prefix: /opt/conda/envs/PlasmaPy

plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[(1.2+4.4j)-(-0.05424615706922327+0.20796058435985562j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[9.2j-0.10806460304119532j] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[9j-(-0.012123822585585753+0j)]
plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_errors[-TypeError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_errors[w1-UnitsError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_errors[inf-ValueError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_errors[nan-ValueError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_deriv_errors[-TypeError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_deriv_errors[w1-UnitsError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_deriv_errors[inf-ValueError] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_deriv_errors[nan-ValueError]
plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[0-1.7724538509055159j] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[1-(-1.0761590138255368+0.6520493321732922j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[1j-0.7578721561413119j] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[(5.4-3.1j)-(-0.1392248730517131-0.0820678226401558j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[(9.9-10j)-(2.0138352579470276-25.901274737989727j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func[(4.5-10j)-(-1.3674950463400947e+35-6.853923234842271e+34j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_power_series_expansion plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_roots plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[0--2] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[1-(0.152318-1.3041j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[1j--0.484257] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[(1.2+4.4j)-(-0.0397561-0.0217392j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[(5.4-3.1j)-(0.0124491+0.0231383j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[(9.9-10j)-(476.153+553.121j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[(5+7j)-(-0.0045912-0.0126104j)] plasmapy/mathematics/tests/test_dispersion.py::test_plasma_dispersion_func_deriv[(4.5-10j)-(2.60153e+36-2.11814e+36j)]
plasmapy/mathematics/mathematics.py
plasmapy/mathematics/mathematics.py