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

Move symbolic functions out of ntheory #26050

Merged
merged 19 commits into from Mar 8, 2024

Conversation

haru-44
Copy link
Member

@haru-44 haru-44 commented Jan 7, 2024

References to other Issues or PRs

Brief description of what is fixed or changed

The following functions have been changed (mobius has been fixed in other PRs).

functions states target location new/existing imports
sympy.ntheory.factor_.divisor_sigma deprecated sympy.functions.combinatorial.numbers.divisor_sigma new top-level
sympy.ntheory.factor_.primenu deprecated sympy.functions.combinatorial.numbers.primenu new top-level
sympy.ntheory.factor_.primeomega deprecated sympy.functions.combinatorial.numbers.primeomega new top-level
sympy.ntheory.factor_.reduce_totient deprecated sympy.functions.combinatorial.numbers.reduce_totient new top-level
sympy.ntheory.factor_.totient deprecated sympy.functions.combinatorial.numbers.totient new top-level
sympy.ntheory.factor_.udivisor_sigma deprecated sympy.functions.combinatorial.numbers.udivisor_sigma new sympy.functions
sympy.ntheory.generate.primepi deprecated sympy.functions.combinatorial.numbers.primepi new top-level
sympy.partitions_.npartitions deprecated sympy.functions.combinatorial.numbers.partition existing top-level
sympy.ntheory.residue_ntheory.jacobi_symbol deprecated sympy.functions.combinatorial.numbers.jacobi_symbol new top-level
sympy.ntheory.residue_ntheory.kronecker_symbol deleted sympy.functions.combinatorial.numbers.kronecker_symbol new top-level
sympy.ntheory.residue_ntheory.legendre_symbol deprecated sympy.functions.combinatorial.numbers.legendre_symbol new top-level
sympy.ntheory.residue_ntheory.mobius deprecated sympy.functions.combinatorial.numbers.mobius new top-level
sympy.functions.combinatorial.numbers.carmichael.is_carmichael deprecated sympy.ntheory.factor_.is_carmichael new top-level
sympy.functions.combinatorial.numbers.carmichael.find_carmichael_numbers_in_range deprecated sympy.ntheory.factor_.find_carmichael_numbers_in_range new sympy.ntheory.factor_
sympy.functions.combinatorial.numbers.carmichael.find_first_n_carmichaels deprecated sympy.ntheory.factor_.find_first_n_carmichaels new sympy.ntheory.factor_
  • Most functions are deprecated, but the kronecker_symbol function was added to ntheory after the 1.12 release and deleted.
  • Most functions are newly created. Since npartitions and partition existed as functions with similar functions, they have been consolidated into partition.
  • Functions marked top-level can be imported like from sympy import mobius. Other functions can be imported as described (e.g., from sympy.functions import udivisor_sigma).
  • The following functions have been added as private functions. All of them are functions for numerical calculations.
    • sympy.ntheory.factor_._divisor_sigma
    • sympy.ntheory.generate._primepi
    • sympy.partitions_._partition_rec, sympy.partitions_._partition

Other comments

Release Notes

  • functions
    • DEPRECATION : moved is_carmichael from functions to ntheory. The code from sympy import carmichael; carmichael.is_carmichael(1) or from sympy.functions import carmichael; carmichael.is_carmichael(1) needs to be modified to from sympy import is_carmichael; is_carmichael(1).
    • DEPRECATION : moved find_carmichael_numbers_in_range, find_first_n_carmichaels from functions to ntheory. The code from sympy import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2) or from sympy.functions import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2) needs to be modified to from sympy.ntheory.factor_ import find_carmichael_numbers_in_range; find_carmichael_numbers_in_range(1, 2).
    • Add new function kronecker_symbol
  • ntheory
    • DEPRECATION : moved primenu, primeomega, totient, reduce_totient, divisor_sigma, primepi, npartitions, legendre_symbol, jacobi_symbol from ntheory to functions. Code that imports these functions from top-level like from sympy import mobius will continue to work fine. However code that imports these from the fully qualified module like from sympy.ntheory import mobius or from sympy.ntheory.residue_ntheory import mobius will now see a deprecation warning. The new location for these functions is in sympy.functions but the intended way to import them is still from top-level like from sympy import mobius.
    • DEPRECATION : moved udivisor_sigma from ntheory to functions. The code from sympy.ntheory.factor_ import udivisor_sigma needs to be modified to from sympy.functions import udivisor_sigma.

@sympy-bot
Copy link

sympy-bot commented Jan 7, 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

    • DEPRECATION : moved is_carmichael from functions to ntheory. The code from sympy import carmichael; carmichael.is_carmichael(1) or from sympy.functions import carmichael; carmichael.is_carmichael(1) needs to be modified to from sympy import is_carmichael; is_carmichael(1). (#26050 by @haru-44)

    • DEPRECATION : moved find_carmichael_numbers_in_range, find_first_n_carmichaels from functions to ntheory. The code from sympy import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2) or from sympy.functions import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2) needs to be modified to from sympy.ntheory.factor_ import find_carmichael_numbers_in_range; find_carmichael_numbers_in_range(1, 2). (#26050 by @haru-44)

    • Add new function kronecker_symbol (#26050 by @haru-44)

  • ntheory

    • DEPRECATION : moved primenu, primeomega, totient, reduce_totient, divisor_sigma, primepi, npartitions, legendre_symbol, jacobi_symbol from ntheory to functions. Code that imports these functions from top-level like from sympy import mobius will continue to work fine. However code that imports these from the fully qualified module like from sympy.ntheory import mobius or from sympy.ntheory.residue_ntheory import mobius will now see a deprecation warning. The new location for these functions is in sympy.functions but the intended way to import them is still from top-level like from sympy import mobius. (#26050 by @haru-44)

    • DEPRECATION : moved udivisor_sigma from ntheory to functions. The code from sympy.ntheory.factor_ import udivisor_sigma needs to be modified to from sympy.functions import udivisor_sigma. (#26050 by @haru-44)

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. -->
* #26034
* #26042


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

The following functions have been changed (`mobius` has been fixed in other PRs).

|functions                                                                         |states     |target location                                        |new/existing |imports                 |
|:-------------------------------------------------------------------------------- |:--------- |:----------------------------------------------------- |:----------- |:---------------------- |
|sympy.ntheory.factor_.divisor_sigma                                               |deprecated |sympy.functions.combinatorial.numbers.divisor_sigma    |new          |top-level               |
|sympy.ntheory.factor_.primenu                                                     |deprecated |sympy.functions.combinatorial.numbers.primenu          |new          |top-level               |
|sympy.ntheory.factor_.primeomega                                                  |deprecated |sympy.functions.combinatorial.numbers.primeomega       |new          |top-level               |
|sympy.ntheory.factor_.reduce_totient                                              |deprecated |sympy.functions.combinatorial.numbers.reduce_totient   |new          |top-level               |
|sympy.ntheory.factor_.totient                                                     |deprecated |sympy.functions.combinatorial.numbers.totient          |new          |top-level               |
|sympy.ntheory.factor_.udivisor_sigma                                              |deprecated |sympy.functions.combinatorial.numbers.udivisor_sigma   |new          |`sympy.functions`       |
|sympy.ntheory.generate.primepi                                                    |deprecated |sympy.functions.combinatorial.numbers.primepi          |new          |top-level               |
|sympy.partitions_.npartitions                                                     |deprecated |sympy.functions.combinatorial.numbers.partition        |existing     |top-level               |
|sympy.ntheory.residue_ntheory.jacobi_symbol                                       |deprecated |sympy.functions.combinatorial.numbers.jacobi_symbol    |new          |top-level               |
|sympy.ntheory.residue_ntheory.kronecker_symbol                                    |deleted    |sympy.functions.combinatorial.numbers.kronecker_symbol |new          |top-level               |
|sympy.ntheory.residue_ntheory.legendre_symbol                                     |deprecated |sympy.functions.combinatorial.numbers.legendre_symbol  |new          |top-level               |
|sympy.ntheory.residue_ntheory.mobius                                              |deprecated |sympy.functions.combinatorial.numbers.mobius           |new          |top-level               |
|sympy.functions.combinatorial.numbers.carmichael.is_carmichael                    |deprecated |sympy.ntheory.factor_.is_carmichael                    |new          |top-level               |
|sympy.functions.combinatorial.numbers.carmichael.find_carmichael_numbers_in_range |deprecated |sympy.ntheory.factor_.find_carmichael_numbers_in_range |new          |`sympy.ntheory.factor_` |
|sympy.functions.combinatorial.numbers.carmichael.find_first_n_carmichaels         |deprecated |sympy.ntheory.factor_.find_first_n_carmichaels         |new          |`sympy.ntheory.factor_` |

* Most functions are `deprecated`, but the `kronecker_symbol` function was added to `ntheory` after the 1.12 release and deleted.
* Most functions are newly created. Since `npartitions` and `partition` existed as functions with similar functions, they have been consolidated into `partition`.
* Functions marked `top-level` can be imported like `from sympy import mobius`. Other functions can be imported as described (e.g., `from sympy.functions import udivisor_sigma`).
* The following functions have been added as private functions. All of them are functions for numerical calculations.
  * `sympy.ntheory.factor_._divisor_sigma`
  * `sympy.ntheory.generate._primepi`
  * `sympy.partitions_._partition_rec`, `sympy.partitions_._partition`

#### 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
  * DEPRECATION : moved `is_carmichael` from `functions` to `ntheory`. The code `from sympy import carmichael; carmichael.is_carmichael(1)` or `from sympy.functions import carmichael; carmichael.is_carmichael(1)` needs to be modified to `from sympy import is_carmichael; is_carmichael(1)`.
  * DEPRECATION : moved `find_carmichael_numbers_in_range`, `find_first_n_carmichaels` from `functions` to `ntheory`. The code `from sympy import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2)` or `from sympy.functions import carmichael; carmichael.find_carmichael_numbers_in_range(1, 2)` needs to be modified to `from sympy.ntheory.factor_ import find_carmichael_numbers_in_range; find_carmichael_numbers_in_range(1, 2)`.
  * Add new function `kronecker_symbol`
* ntheory
  * DEPRECATION : moved `primenu`, `primeomega`, `totient`, `reduce_totient`, `divisor_sigma`, `primepi`, `npartitions`, `legendre_symbol`, `jacobi_symbol` from `ntheory` to `functions`. Code that imports these functions from top-level like ``from sympy import mobius`` will continue to work fine. However code that imports these from the fully qualified module like ``from sympy.ntheory import mobius`` or ``from sympy.ntheory.residue_ntheory import mobius`` will now see a deprecation warning. The new location for these functions is in ``sympy.functions`` but the intended way to import them is still from top-level like ``from sympy import mobius``.
  * DEPRECATION : moved `udivisor_sigma` from `ntheory` to `functions`. The code `from sympy.ntheory.factor_ import udivisor_sigma` needs to be modified to `from sympy.functions import udivisor_sigma`.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

Copy link

github-actions bot commented Jan 7, 2024

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

| Change   | Before [a00718ba]    | After [14a6e27d]    |   Ratio | Benchmark (Parameter)                                                |
|----------|----------------------|---------------------|---------|----------------------------------------------------------------------|
| -        | 68.8±0.3ms           | 45.2±0.4ms          |    0.66 | integrate.TimeIntegrationRisch02.time_doit(10)                       |
| -        | 69.0±0.8ms           | 43.8±1ms            |    0.63 | integrate.TimeIntegrationRisch02.time_doit_risch(10)                 |
| +        | 19.0±0.4μs           | 30.2±0.2μs          |    1.59 | integrate.TimeIntegrationRisch03.time_doit(1)                        |
| -        | 5.26±0.02ms          | 2.85±0.04ms         |    0.54 | logic.LogicSuite.time_load_file                                      |
| -        | 73.0±0.3ms           | 29.0±0.2ms          |    0.4  | polys.TimeGCD_GaussInt.time_op(1, 'dense')                           |
| -        | 26.0±0.1ms           | 17.1±0.08ms         |    0.66 | polys.TimeGCD_GaussInt.time_op(1, 'expr')                            |
| -        | 73.3±0.8ms           | 29.5±0.3ms          |    0.4  | polys.TimeGCD_GaussInt.time_op(1, 'sparse')                          |
| -        | 252±2ms              | 125±2ms             |    0.5  | polys.TimeGCD_GaussInt.time_op(2, 'dense')                           |
| -        | 256±1ms              | 126±0.4ms           |    0.49 | polys.TimeGCD_GaussInt.time_op(2, 'sparse')                          |
| -        | 659±3ms              | 374±2ms             |    0.57 | polys.TimeGCD_GaussInt.time_op(3, 'dense')                           |
| -        | 660±3ms              | 375±1ms             |    0.57 | polys.TimeGCD_GaussInt.time_op(3, 'sparse')                          |
| -        | 495±4μs              | 290±2μs             |    0.58 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(1, 'dense')            |
| -        | 1.78±0.02ms          | 1.06±0.01ms         |    0.59 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(2, 'dense')            |
| -        | 5.81±0.02ms          | 3.13±0.01ms         |    0.54 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(3, 'dense')            |
| -        | 444±3μs              | 228±1μs             |    0.51 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(1, 'dense')               |
| -        | 1.47±0.01ms          | 687±4μs             |    0.47 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(2, 'dense')               |
| -        | 4.98±0.07ms          | 1.65±0.01ms         |    0.33 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(3, 'dense')               |
| -        | 380±8μs              | 205±0.8μs           |    0.54 | polys.TimeGCD_SparseGCDHighDegree.time_op(1, 'dense')                |
| -        | 2.47±0.02ms          | 1.24±0.01ms         |    0.5  | polys.TimeGCD_SparseGCDHighDegree.time_op(3, 'dense')                |
| -        | 10.0±0.1ms           | 4.38±0.03ms         |    0.44 | polys.TimeGCD_SparseGCDHighDegree.time_op(5, 'dense')                |
| -        | 363±8μs              | 169±0.6μs           |    0.47 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(1, 'dense')            |
| -        | 2.49±0.02ms          | 907±10μs            |    0.36 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(3, 'dense')            |
| -        | 9.74±0.09ms          | 2.66±0.01ms         |    0.27 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(5, 'dense')            |
| -        | 1.01±0ms             | 425±2μs             |    0.42 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'dense')           |
| -        | 1.77±0.03ms          | 503±3μs             |    0.28 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse')          |
| -        | 5.85±0.08ms          | 1.79±0.01ms         |    0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'dense')           |
| -        | 8.35±0.02ms          | 1.50±0.01ms         |    0.18 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse')          |
| -        | 286±2μs              | 64.0±0.4μs          |    0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse')             |
| -        | 3.44±0.02ms          | 397±5μs             |    0.12 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'dense')              |
| -        | 3.95±0.03ms          | 282±3μs             |    0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse')             |
| -        | 7.09±0.03ms          | 1.26±0.01ms         |    0.18 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'dense')              |
| -        | 8.75±0.1ms           | 843±8μs             |    0.1  | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse')             |
| -        | 5.06±0.04ms          | 3.02±0.01ms         |    0.6  | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| -        | 12.1±0.1ms           | 6.71±0.05ms         |    0.55 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'dense')  |
| -        | 22.4±0.2ms           | 9.11±0.1ms          |    0.41 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| -        | 5.24±0.03ms          | 878±10μs            |    0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse')    |
| -        | 12.6±0.06ms          | 7.10±0.04ms         |    0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse')    |
| -        | 103±0.6ms            | 26.2±0.2ms          |    0.25 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'dense')     |
| -        | 167±0.9ms            | 53.9±0.2ms          |    0.32 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse')    |
| -        | 175±0.5μs            | 112±0.8μs           |    0.64 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'dense')      |
| -        | 359±2μs              | 214±3μs             |    0.6  | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'sparse')     |
| -        | 4.40±0.02ms          | 858±3μs             |    0.19 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'dense')      |
| -        | 5.41±0.02ms          | 383±2μs             |    0.07 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse')     |
| -        | 20.0±0.08ms          | 2.86±0.06ms         |    0.14 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'dense')      |
| -        | 22.9±0.2ms           | 625±2μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse')     |
| -        | 478±2μs              | 134±0.4μs           |    0.28 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| -        | 4.75±0.04ms          | 622±5μs             |    0.13 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'dense')  |
| -        | 5.36±0.01ms          | 139±1μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| -        | 13.5±0.2ms           | 1.30±0.02ms         |    0.1  | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'dense')  |
| -        | 14.0±0.09ms          | 143±1μs             |    0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| -        | 132±0.5μs            | 73.9±0.9μs          |    0.56 | solve.TimeMatrixOperations.time_rref(3, 0)                           |
| -        | 248±1μs              | 87.3±0.3μs          |    0.35 | solve.TimeMatrixOperations.time_rref(4, 0)                           |
| -        | 24.1±0.04ms          | 10.4±0.1ms          |    0.43 | solve.TimeSolveLinSys189x49.time_solve_lin_sys                       |
| -        | 28.6±0.3ms           | 15.9±0.2ms          |    0.56 | solve.TimeSparseSystem.time_linsolve_Aaug(20)                        |
| -        | 55.0±0.2ms           | 25.3±0.05ms         |    0.46 | solve.TimeSparseSystem.time_linsolve_Aaug(30)                        |
| -        | 28.3±0.3ms           | 15.6±0.4ms          |    0.55 | solve.TimeSparseSystem.time_linsolve_Ab(20)                          |
| -        | 54.1±0.2ms           | 25.1±0.2ms          |    0.46 | solve.TimeSparseSystem.time_linsolve_Ab(30)                          |

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

Comment on lines 435 to 441
Symbolic functions in ``ntheory`` have been moved to ``functions``.
Specifically, the following functions.

* ``sympy.ntheory.factor_.primenu``
* ``sympy.ntheory.factor_.primeomega``
* ``sympy.ntheory.factor_.totient``
* ``sympy.ntheory.residue_ntheory.mobius``
Copy link
Contributor

Choose a reason for hiding this comment

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

The deprecation note here should be a bit clearer about what is happening from a user perspective.

All of these functions can be imported like from sympy import mobius which continues to work just fine after these changes as well as it did before. What is relevant for users/downstream is that code that does from sympy.ntheory.residue_ntheory import mobius should be changed to from sympy import mobius.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a description.

Comment on lines 435 to 446
Symbolic functions in ``ntheory`` have been moved to ``functions``.
Specifically, the following functions.

All of these functions can be imported like ``from sympy import mobius`` which
continues to work just fine after these changes as well as it did before.
However, if you are using ``from sympy.ntheory import mobius``, you need to
change to ``from sympy import mobius``.

* ``sympy.ntheory.factor_.primenu``
* ``sympy.ntheory.factor_.primeomega``
* ``sympy.ntheory.factor_.totient``
* ``sympy.ntheory.residue_ntheory.mobius``
Copy link
Contributor

Choose a reason for hiding this comment

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

The list of functions should come after "the following functions".

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this what you mean?

Symbolic functions in ``ntheory`` have been moved to ``functions``.
All of these functions can be imported like ``from sympy import mobius`` which
continues to work just fine after these changes as well as it did before.
However, if you are using ``from sympy.ntheory import mobius``, you need to
change to ``from sympy import mobius``. Specifically, the following functions.

* ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that is one possibility. Just when you say "the following functions" usually the list should follow immediately.

Comment on lines 433 to 444
### Cleaning up symbolic version functions in ``ntheory``

Symbolic functions in ``ntheory`` have been moved to ``functions``.
Specifically, the following functions.

All of these functions can be imported like ``from sympy import mobius`` which
continues to work just fine after these changes as well as it did before.
However, if you are using ``from sympy.ntheory import mobius``, you need to
change to ``from sympy import mobius``. Specifically, the following functions.

* ``sympy.ntheory.factor_.primenu``
* ``sympy.ntheory.factor_.primeomega``
* ``sympy.ntheory.factor_.totient``
* ``sympy.ntheory.residue_ntheory.mobius``
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay here is how I suggest to word the whole thing:

### Relocate symbolic functions from ``ntheory`` to ``functions``

The following symbolic functions in ``ntheory`` have been moved to
``functions``:

* ``sympy.ntheory.factor_.primenu``
* ``sympy.ntheory.factor_.primeomega``
* ``sympy.ntheory.factor_.totient``
* ``sympy.ntheory.residue_ntheory.mobius``

Code that imports these functions from top-level like ``from sympy import
mobius`` will continue to work fine. However code that imports these from the
fully qualified module like ``from sympy.ntheory import mobius`` or ``from
sympy.ntheory.residue_ntheory import mobius`` will now see a deprecation
warning. The new location for these functions is in ``sympy.functions`` but the
intended way to import them is still from top-level like ``from sympy import
mobius``.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you.

@haru-44 haru-44 marked this pull request as ready for review January 16, 2024 13:40
@oscarbenjamin
Copy link
Contributor

Can you include a summary in the OP of what happened with each individual function like what has been moved where, what has been renamed or deprecated, what has been added etc?

Are all of the functions that have been moved importable at top-level in SymPy 1.12?

The release note should say DEPRECATION rather than BREAKING CHANGE if something is deprecated but still works. The release note should also be clear about how downstream code should be expected to be changed as a result of the changes here.

@oscarbenjamin
Copy link
Contributor

I would like someone else to review this.

@haru-44
Copy link
Member Author

haru-44 commented Jan 17, 2024

Can you include a summary in the OP of what happened with each individual function like what has been moved where, what has been renamed or deprecated, what has been added etc?

Are all of the functions that have been moved importable at top-level in SymPy 1.12?

The release note should say DEPRECATION rather than BREAKING CHANGE if something is deprecated but still works. The release note should also be clear about how downstream code should be expected to be changed as a result of the changes here.

Fixed the OP. If there are any unclear points, please let me know.

@haru-44
Copy link
Member Author

haru-44 commented Feb 4, 2024

If possible, I would like to get this done in time for the 1.13 release(#26169).

@oscarbenjamin oscarbenjamin added this to the SymPy 1.13 milestone Feb 5, 2024
@oscarbenjamin oscarbenjamin reopened this Mar 8, 2024
@oscarbenjamin oscarbenjamin merged commit 81afa9b into sympy:master Mar 8, 2024
123 of 128 checks passed
@oscarbenjamin
Copy link
Contributor

Looks good. Thanks @haru-44 !

@haru-44
Copy link
Member Author

haru-44 commented Mar 9, 2024

thanks

@haru-44 haru-44 deleted the ntheory_functions branch April 27, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants