Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fresnel integrals of real inputs #20

Open
ethanbarry opened this issue Aug 17, 2024 · 1 comment
Open

Fresnel integrals of real inputs #20

ethanbarry opened this issue Aug 17, 2024 · 1 comment

Comments

@ethanbarry
Copy link
Contributor

The Fresnel Integrals are two functions
$$S(x)=\int_0^x \sin(t^2),dt$$
and
$$C(x)=\int_0^x \cos(t^2),dt$$
which come up a lot in optics and stuff. It'd be nice if we could provide these functions to users, but there's no material on them in Numerical Recipes. I've experimented with a few different approximations, but I think the nicest is probably the one due to J. Boersma in this paper (doi↗).

The only trouble is, it uses $i$ in the calculations, so I would need to use the num_complex crate. I know this was discussed in #6 a few months ago. I'm happy to draft a PR if this sounds like a useful contribution...

@ethanbarry
Copy link
Contributor Author

Never mind, Boersma's approximation is awful—it underflows like crazy. Julia's package for the Fresnel integrals simply uses the relation to the error function $\mathrm{erf}(z)$ instead of numerically estimating the Fresnel integral directly. I don't blame them—every algorithm I've found is either accurate to maybe three significant figures, or quite complicated and easy to get wrong.

To use the error function relation, I'd need a complex implementation of $\mathrm{erf}(z)$...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant