Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unclear docstring for airyx #17032

Closed
giordano opened this issue Jun 20, 2016 · 6 comments
Closed

Unclear docstring for airyx #17032

giordano opened this issue Jun 20, 2016 · 6 comments
Labels
docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants maths Mathematical functions

Comments

@giordano
Copy link
Contributor

The docstring of airyx function reads:

scaled k-th derivative of the Airy function, return \operatorname{Ai}(x) e^{\frac{2}{3} x \sqrt{x}} for k == 0 || k == 1\ , and \operatorname{Ai}(x) e^{- \left| \operatorname{Re} \left( \frac{2}{3} x \sqrt{x} \right) \right|} for k == 2 || k == 3.

This is at best unclear, if not misleading. airyx(2, x) isn't the scaled second derivative of Airy Ai function, but rather the scaled Airy Bi function, like airyx(3, x) isn't the scaled third derivative of Airy Ai.

In addition, how is the scaling factor computed? For negative real values of x it should be complex according to the docstring (at least in the case k == 0 || k ==1), but airyx(0, -1.23) is real. GSL uses 1 as scaling factor for negative real x, but this isn't the case for Julia's airyx, because airyx(0, -1.23) != airy(0, -1.23).

@kshyatt kshyatt added docs This change adds or pertains to documentation maths Mathematical functions good first issue Indicates a good issue for first-time contributors to Julia labels Jun 20, 2016
@tkelman
Copy link
Contributor

tkelman commented Jun 21, 2016

cc @simonbyrne or @stevengj might be the most knowledgeable here

@giordano
Copy link
Contributor Author

giordano commented Aug 14, 2016

Actually also the docstring of airy(k, x) is wrong: airy(2, x) isn't the first and second derivative of airy(1, x) and airy(0, x), respectively, it's just the airybi function. The same applies to airy(3, x)

@stevengj
Copy link
Member

stevengj commented Aug 15, 2016

Yeah that looks right at first glance in the source code. Can we rename these horrible functions? It looks like the Fortran interface was copied a little too literally (or is it Matlab's fault?)—I'd rather just define eight functions in Julia (for Ai, Ai', Bi, Bi', and the scaled versions) rather than pass these obscure integer arguments.

The scaling is defined by the kode=2documentation in zairy.f and zbiry.f, I believe.

@tkelman
Copy link
Contributor

tkelman commented Aug 15, 2016

These should be moved to a special functions package where they can be named more idiomatically.

@giordano
Copy link
Contributor Author

These should be moved to a special functions package where they can be named more idiomatically.

Actually I like about Julia that you don't have to install and load an external package in order to use common special functions.

@tkelman
Copy link
Contributor

tkelman commented Aug 16, 2016

Sorry, that's going to change, there's zero technical reason for them to be here and tied to the development schedule of the base language.

simonbyrne added a commit that referenced this issue Aug 16, 2016
This rearranges the different airy functions, deprecating `airy`, `airyx` and `airyprime` in favour of the more specific variants (`airyai`, `airyaiprime`, etc.), and clarifies the docs of each remaining function. Fixes #17032.
simonbyrne added a commit that referenced this issue Sep 7, 2016
This rearranges the different airy functions, deprecating `airy`, `airyx` and `airyprime` in favour of the more specific variants (`airyai`, `airyaiprime`, etc.), and clarifies the docs of each remaining function. Fixes #17032.
simonbyrne added a commit that referenced this issue Sep 7, 2016
This rearranges the different airy functions, deprecating `airy`, `airyx` and `airyprime` in favour of the more specific variants (`airyai`, `airyaiprime`, etc.), and clarifies the docs of each remaining function. Fixes #17032.
@kshyatt kshyatt added the Hacktoberfest Good for Hacktoberfest participants label Oct 5, 2016
simonbyrne added a commit that referenced this issue Dec 22, 2016
This rearranges the different airy functions, deprecating `airy`, `airyx` and `airyprime` in favour of the more specific variants (`airyai`, `airyaiprime`, etc.), and clarifies the docs of each remaining function. Fixes #17032.
tkelman pushed a commit that referenced this issue Dec 29, 2016
This rearranges the different airy functions, deprecating `airy`, `airyx` and `airyprime` in favour of the more specific variants (`airyai`, `airyaiprime`, etc.), and clarifies the docs of each remaining function. Fixes #17032.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation good first issue Indicates a good issue for first-time contributors to Julia Hacktoberfest Good for Hacktoberfest participants maths Mathematical functions
Projects
None yet
Development

No branches or pull requests

4 participants