Open mkoeppe opened 3 years ago
Changed dependencies from #32226 to none
Description changed:
---
+++
@@ -2,5 +2,19 @@
We should replace it by documentation that empowers users to use Sage functions with `scipy` (including the `sage.ext.fast_callable` facility).
+Within the Sage library itself, there is only minimal use of this module.
+
+```
+$ git grep sage.numerical.optimize
+src/doc/en/reference/numerical/index.rst: sage/numerical/optimize
+src/sage/coding/code_bounds.py: from sage.numerical.optimize import find_root
+src/sage/crypto/lwe.py:from sage.numerical.optimize import find_root
+src/sage/numerical/all.py:lazy_import("sage.numerical.optimize",
+src/sage/numerical/optimize.py: sage: from sage.numerical.optimize import binpacking
+src/sage/numerical/optimize.py: sage: from sage.numerical.optimize import binpacking
+src/sage/symbolic/expression.pyx: from sage.numerical.optimize import find_root
+src/sage/symbolic/expression.pyx: Uses :func:`sage.numerical.optimize.find_local_minimum`.
+src/sage/symbolic/expression.pyx: from sage.numerical.optimize import find_local_minimum
+```
Description changed:
---
+++
@@ -17,4 +17,5 @@
src/sage/symbolic/expression.pyx: from sage.numerical.optimize import find_local_minimum
+The book Computational Mathematics with SageMath only refers to one of these functions, find_root
(both the global and the Expression.find_root
method).
New commits:
84c4a6e | src/sage/coding/code_bounds.py: Replace use of sage.numerical.optimize by a direct scipy call |
I'm not so sure about this one. These functions are minimal(ish) wrappers around scipy that,
The essence of sage is wrapping other scientific libraries in a consistent and user-friendly interface. What find_root
does (for example) is not rocket surgery, but I certainly wouldn't want to write it myself every time I have a calc1 problem to double-check.
In other news, Gregory Bard's book (http://gregorybard.com/Sage.html) also uses a few of these functions.
Thanks for the input and the pointer.
I think we need to break this down function by function.
Description changed:
---
+++
@@ -19,3 +19,6 @@
The book [Computational Mathematics with SageMath](http://sagebook.gforge.inria.fr/english.html) only refers to one of these functions, `find_root` (both the global and the `Expression.find_root` method).
+
+Symptoms:
+- `minimize_constrained` https://groups.google.com/g/sage-devel/c/5vp5UTexpxQ/m/DG_lmN9ZAwAJ
Description changed:
---
+++
@@ -1,6 +1,20 @@
-There is no added value that the functions `find_root`, `find_local_maximum`, `find_local_minimum`, `minimize`, `minimize_constrained`, `find_fit` would provide over just using `scipy`.
+`sage.numerical.optimize` provides the following functions:
-We should replace it by documentation that empowers users to use Sage functions with `scipy` (including the `sage.ext.fast_callable` facility).
+- [find_root](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_root) [1] refers to this function and to the `Expression.find_root` method
+
+- [find_local_minimum](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_local_minimum), `find_local_maximum`
+
+- [minimize](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize)
+
+- [minimize_constrained](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize_constrained)
+
+- [find_fit](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_fit)
+
+([linear_program](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.linear_program) is already deprecated; we ignore the function [binpacking](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.binpacking) in this ticket.)
+
+[1] Book [Computational Mathematics with SageMath](http://sagebook.gforge.inria.fr/english.html)
+[2] [Gregory Bard's book](http://gregorybard.com/Sage.html)
+
Within the Sage library itself, there is only minimal use of this module.
@@ -17,7 +31,12 @@
src/sage/symbolic/expression.pyx: from sage.numerical.optimize import find_local_minimum
-The book Computational Mathematics with SageMath only refers to one of these functions, find_root
(both the global and the Expression.find_root
method).
+
+In this ticket, we
+- discuss which of these functions provide sufficient added value to users over just using scipy
;
+- deprecate functions that do not provide sufficient added value;
+- provide documentation that empowers users to use Sage functions with scipy
(including the sage.ext.fast_callable
facility).
+
Symptoms:
Author: Matthias Koeppe
Description changed:
---
+++
@@ -35,7 +35,7 @@
In this ticket, we
- discuss which of these functions provide sufficient added value to users over just using `scipy`;
- deprecate functions that do not provide sufficient added value;
-- provide documentation that empowers users to use Sage functions with `scipy` (including the `sage.ext.fast_callable` facility).
+- provide documentation that empowers users to use Sage functions with `scipy` (including the `sage.ext.fast_callable` facility) - see #24536 for some new adapters
Thanks for the input and the pointer.
I think we need to break this down function by function.
+1
Ideally these could be pretty light wrappers in general. But having something top-level for undergraduate instruction is very, very convenient (as evidenced by the two books mentioned in the ticket).
Description changed:
---
+++
@@ -9,6 +9,7 @@
- [minimize_constrained](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize_constrained)
- [find_fit](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_fit)
+ - appears in [2] in a short section titled "making your own regressions in Sage"
([linear_program](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.linear_program) is already deprecated; we ignore the function [binpacking](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.binpacking) in this ticket.)
Description changed:
---
+++
@@ -1,12 +1,16 @@
`sage.numerical.optimize` provides the following functions:
-- [find_root](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_root) [1] refers to this function and to the `Expression.find_root` method
+- [find_root](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_root)
+ - [1] refers to this function and to the `Expression.find_root` method
+ - [2] refers to this function in a short section "using Sage as a numerical solver" - which explains `sage_root` and nothing else
- [find_local_minimum](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_local_minimum), `find_local_maximum`
+ - does not appear in [2]
- [minimize](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize)
-
+ - appears in [2] in a section "Minimizations and Lagrange Multipliers"
- [minimize_constrained](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize_constrained)
+ - does not appear in [2]
- [find_fit](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_fit)
- appears in [2] in a short section titled "making your own regressions in Sage"
Replying to @kcrisman:
something top-level for undergraduate instruction is very, very convenient (as evidenced by the two books mentioned in the ticket).
Well, I have looked at the sections related to the present ticket in the books and I wouldn't recommend using these parts for instruction at any level.
Description changed:
---
+++
@@ -5,14 +5,18 @@
- [2] refers to this function in a short section "using Sage as a numerical solver" - which explains `sage_root` and nothing else
- [find_local_minimum](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_local_minimum), `find_local_maximum`
+ - does not appear in [1]
- does not appear in [2]
- [minimize](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize)
- - appears in [2] in a section "Minimizations and Lagrange Multipliers"
+ - does not appear in [1]
+ - appears in [2] in a section "Minimizations and Lagrange Multipliers" (the latter ends in a disappointment)
+
- [minimize_constrained](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize_constrained)
- does not appear in [2]
- [find_fit](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.find_fit)
+ - does not appear in [1]
- appears in [2] in a short section titled "making your own regressions in Sage"
([linear_program](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.linear_program) is already deprecated; we ignore the function [binpacking](https://doc.sagemath.org/html/en/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.binpacking) in this ticket.)
Replying to @kcrisman:
Ideally these could be pretty light wrappers in general. But having something top-level for undergraduate instruction is very, very convenient (as evidenced by the two books mentioned in the ticket).
I fully agree. For instance, I would be -1 in removing find_root
for it is heavily used and very convenient for a basic usage. For more sophisticated use, of course, the user shall import scipy
functions.
Yes, find_root
is not so bad.
An ask.sagemath.org
question stumbles on a problem possibly related to minimize_constrained
; I have filed a corresponding issue.
On the general deprecation issue : I think that we should keep "frequently used" numerical methods, rathervthan force the end-users to sift through the external spkgs documentation. vind_root
is a caricatural example, but minimize
and minimize_constrained
are also examples often arising in engineering problems. If we aim to make Sage usable by "mere engineers", we'd better keep (and advertise !) these tools.
Life is not all geometric algebra...
sage.numerical.optimize
provides the following functions:find_root
Expression.find_root
methodsage_root
and nothing elsefind_local_minimum,
find_local_maximum
minimize
minimize_constrained
find_fit
(linear_program is already deprecated; we ignore the function binpacking in this ticket.)
[1] Book Computational Mathematics with SageMath [2] Gregory Bard's book
Within the Sage library itself, there is only minimal use of this module.
In this ticket, we
scipy
;scipy
(including thesage.ext.fast_callable
facility) - see #24536 for some new adaptersSymptoms:
minimize_constrained
https://groups.google.com/g/sage-devel/c/5vp5UTexpxQ/m/DG_lmN9ZAwAJCC: @dimpase @orlitzky @sagetrac-tmonteil @slel
Component: numerical
Author: Matthias Koeppe
Branch/Commit: u/mkoeppe/deprecate_sage_numerical_optimize @
84c4a6e
Issue created by migration from https://trac.sagemath.org/ticket/32260