Skip to content

Conversation

mohakmalviya
Copy link
Contributor

References to other Issues or PRs

Fixes #15795

Brief description of what is fixed or changed

This PR adds tests to verify the numerical evaluation of the assoc_legendre function for non integer arguments, ensuring compatibility with expected results from mpmath's legenp. The addition of these tests aims to improve the robustness and accuracy of special functions in Sympy.

Other comments

Release Notes

  • functions
    • Added tests for assoc_legendre to verify its numerical evaluation with non-integer arguments

- Implemented tests to verify the numerical evaluation of assoc_legendre
  function for both integer and complex arguments against known results
  from mpmath. This ensures compatibility and correctness of the
  assoc_legendre function when dealing with non-integer and complex
  parameters, aligning with mpmath's legenp functionality.

- The tests include comparisons using the all_close function from
  sympy.core.numbers to check if the results are within an acceptable
  tolerance level, addressing the issue of numerical precision in
  floating-point calculations.

Example:
  The test checks assoc_legendre(1, 1/2, 0.1).evalf() against
  mpmath's result -0.474572528387641 and assoc_legendre(2, 1, 3).evalf()
  against -25.45584412271571*I, ensuring that the evaluations are
  consistent with expected numerical outcomes.

Issue adressed - sympy#15795

This contribution enhances the numerical evaluation capabilities of legendre functions in Sympy, particularly
focusing on the assoc_legendre function's ability to handle non-integer
arguments effectively.

Known issues:
  - Further investigation might be needed for edge cases not covered
    by the current tests.
  - Compatibility with other special functions and their numerical
    evaluation should be considered in future work.
@sympy-bot
Copy link

sympy-bot commented Feb 18, 2024

Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • functions
    • Added tests for assoc_legendre to verify its numerical evaluation with non-integer arguments (#26247 by @mohakmalviya)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13.

Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->

Fixes #15795 

#### Brief description of what is fixed or changed

This PR adds tests to verify the numerical evaluation of the assoc_legendre function for non integer arguments, ensuring compatibility with expected results from mpmath's legenp. The addition of these tests aims to improve the robustness and accuracy of special functions in Sympy.

#### Other comments


#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers. Formerly, `log(-x)` incorrectly gave `-log(x)`.

* physics.units
  * Corrected a semantical error in the conversion between volt and statvolt which
    reported the volt as being larger than the statvolt.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* functions
  * Added tests for assoc_legendre to verify its numerical evaluation with non-integer arguments
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@faze-geek faze-geek merged commit 432f2e7 into sympy:master Feb 23, 2024
@mohakmalviya mohakmalviya deleted the enhance-legendre-functions branch February 23, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legendre functions for non-integer arguments
3 participants