Skip to content

Updated Mathieu function implementation#99

Open
brorson wants to merge 43 commits intoscipy:mainfrom
brorson:Brorson-Mathieu-impl
Open

Updated Mathieu function implementation#99
brorson wants to merge 43 commits intoscipy:mainfrom
brorson:Brorson-Mathieu-impl

Conversation

@brorson
Copy link
Copy Markdown

@brorson brorson commented Feb 23, 2026

I am back. I withdrew my last pull request for my updated Mathieu function impl since I decided to polish the implementation further. Now I am back after making improvements to the impl and fixing some bugs. I received some help from Ho-Chul Shin, whose paper on computing the Mathieu functions appeared in the SIAM Journal in Dec 2025.

Besides improving my implementation I wrote a paper on the details of my implementation. I realize it's difficult to accept a big blob of code implementing a difficult special function without understanding what's in the code. I attempt to explain my implementation in this paper:

https://github.com/brorson/ScipyMathieuPaper

I maintain both Latex and .pdf copies on that GitHub page.

As part of my impl I subjected my functions to some tests to validate their correctness. Results of testing are presented in that paper.

Please reach out to me with any questions -- I am eager to help get this into the SciPy/xsf trunk.

Stuart Brorson
Northeatern University
Boston, Mass, USA

main.c to test_mathieu.cpp in the tests dir.  I ran clang-format on all
.h files.
and lapack which are requred for Mathieu fcns.
Also fix the same build problem when using pixi.  Also rerun clang-format
on all files.
@brorson
Copy link
Copy Markdown
Author

brorson commented Feb 27, 2026

I figured I'd pop in here again and show some test results. All tests are on GitHub under https://github.com/brorson/ScipyMathieuTesting You can use them to check my impl if desired.

Meanwhile here is the eigenvalue spectrum of the existing SciPy Mathieu implementation and my new one:

image image
Existing impl New impl

Here are the Wronskian errors RMS(W(Mx1, Mx2) - 2/pi) for Mc and Ms computed by the existing SciPy impl:
| image | image |

And the new impl:
| image | image |

@brorson
Copy link
Copy Markdown
Author

brorson commented Mar 12, 2026

Fixes #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants