Skip to content

ENH: Add CDF and SF of the cosine distribution to XSF#198

Open
fbourgey wants to merge 3 commits into
scipy:mainfrom
fbourgey:add_cosine
Open

ENH: Add CDF and SF of the cosine distribution to XSF#198
fbourgey wants to merge 3 commits into
scipy:mainfrom
fbourgey:add_cosine

Conversation

@fbourgey

Copy link
Copy Markdown
Member

Reference issue

#170

Same pattern as #171

What does this implement/fix?

Additional information

AI Generation Disclosure

I used Codex to draft a first translation version.

@github-actions github-actions Bot added the Enhancement New feature or request label Jun 18, 2026
Comment thread include/xsf/cosine.h
// ts = mpmath.taylor(f, -mpmath.pi, 20)
// p, q = mpmath.pade(ts, 9, 10)
//
// (A python script with that code is in special/_precompute/cosine_cdf.py.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include this here as well?

@steppi steppi Jun 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scripts for generating reference values belong in xsref

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression was that xsref is for test cases. This little script is for generating coefficients that are used in the code. I don't think xsf has a place yet for storing code-generation code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond test cases it also has test case generation scripts. I also wanted to add things like workflows to get minimax polynomials with remez exchange to what is now xsref. Beyond just test cases and test case generation I think it could be a home for the "meta-code" that goes into xsf. xsref is due for a namechange though and probably xsf too since I hope to expand the scope beyond special functions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression was that xsref is for test cases. This little script is for generating coefficients that are used in the code. I don't think xsf has a place yet for storing code-generation code.

This is what I had in mind too and this is why I kept it from the original Cython file. @steppi what are you suggesting here? should we wait before moving those comments over to xsref or we do it now?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the noise. I thought you were all talking about adding the Python script to the xsf repo, not the comment. I'm on leave and don't have much availability now and trust you all to figure out what's best to do here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, well, I was thinking about adding the Python script that generates the coefficients to the xsf repo. That's where it makes the most sense to me (as opposed to xsref, which I have been seeing as a repo related to test data, including code that generates reference values for unit tests) . But as long as the code is somewhere--even in a comment--then it can be used again by future devs, and they don't have to wonder how the rational approximation was derived.

@dschmitz89 dschmitz89 Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @WarrenWeckesser here. The script that contains the generation of the coefficients belongs in the repo that contains the implementation. Can we agree on adding it here for the time being and potentially move it to xsfref once that is more mature? Otherwise, this PR is mergeable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

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.

4 participants