File:Chapman function.svg

Summary

Description
English: Graphs of the Chapman function
Source Own work
Author Maximilian Reininghaus
Permission
(Reusing this file)
Licence Art Libre Copyleft: This work of art is free; you can redistribute it and/or modify it according to terms of the Free Art License version 1.3 or any later version. You will find a specimen of this license on the Copyleft Attitude site in French, English, German, Polish, and Portuguese as well as on other sites.
Category:FAL-1.3#Chapman%20function.svg
Category:Special functions Category:SVG created with Matplotlib code

Source code

import numpy as np
import scipy.integrate
import matplotlib.pyplot as plt

@np.vectorize
def chapman(x, theta):
    f = lambda l, x, theta: np.exp(-(np.sqrt(x**2 + l**2 + 2*l*x*np.cos(theta)) - x))
    result, err = scipy.integrate.quad(f, 0, np.inf, args=(x, theta))
    return result

th = np.linspace(0, 90, 200)

fig, ax = plt.subplots(dpi=200, figsize=(3,3))
ax.set(yscale="log", ylim=(1, 3e2), xlim=(0, 90), xlabel="$z$", ylabel=r"$\mathrm{ch}(x,z)$")
ax.xaxis.set_major_formatter('{x:.0f}°')

for x in np.logspace(4, 0, 5):
    ch = chapman(x, np.deg2rad(th))
    ax.plot(th, ch, label=f"$x = 10^{{{np.log10(x):.0f}}}$", lw=2)

ax.legend(loc="upper left", fontsize="small")

fig.tight_layout()
fig.savefig("chapman_function.svg")
Category:FAL-1.3 Category:SVG created with Matplotlib code Category:Special functions