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

numerical_approx broken for vectors #12195

Closed
robertwb opened this issue Dec 20, 2011 · 16 comments
Closed

numerical_approx broken for vectors #12195

robertwb opened this issue Dec 20, 2011 · 16 comments

Comments

@robertwb
Copy link
Contributor

#1294 implemented n() but not N() or the functional numerical_approx

Apply:

  1. attachment: trac_12195-numerical-approx-v3.patch

CC: @rbeezer @jasongrout

Component: linear algebra

Keywords: sd40.5

Author: Robert Bradshaw, Rob Beezer, William Stein

Reviewer: Rob Beezer, William Stein, Dan Drake

Merged: sage-5.1.beta4

Issue created by migration from https://trac.sagemath.org/ticket/12195

@robertwb
Copy link
Contributor Author

Attachment: 12195-numerical_approx.patch.gz

@robertwb

This comment has been minimized.

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented Dec 20, 2011

comment:3

Robert,

Looks good, and very welcome. I should have noticed, and fixed, this omission during my big push last year. Looks ready for a positive review, but I have two questions.

  1. Could this make the .n() method (immediate prior in source) obsolete?

  2. This does not seem to show up explicitly anywhere in the documentation. Doing v.N? on an integer vector v seems to just give the generic documentation for a numerical approximation to a single scalar. For matrices, the approach is different. A bit more code, and not overriding the scalar method: Plus: explicit documentation. Minus: duplication of code, including a really bad approximation of log 10 as discussed recently on sage-devel.

A suggestion - add a doctest in this patch for the generic method exhibiting application to vectors. If that's agreeable, I'll make a ticket to have matrices follow the model of this ticket (and maybe even do it).

Rob

@williamstein
Copy link
Contributor

Changed keywords from none to sd40.5

@williamstein
Copy link
Contributor

Author: robertwb

@williamstein
Copy link
Contributor

Reviewer: Rob Beezer, William Stein

@williamstein
Copy link
Contributor

comment:5

This clearly needs work. Rob's point about there being an n method right before is serious. That should be deleted, and was the result of somebody not understanding the architecture of N...

@williamstein
Copy link
Contributor

I fixed the patch by deleting the n function before. Looks great!

@williamstein
Copy link
Contributor

comment:6

Attachment: 12195-numerical_approx.2.patch.gz

apply only: 12195-numerical_approx.2.patch

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented May 27, 2012

Attachment: trac_12195-numerical-approx-v3.patch.gz

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented May 27, 2012

Changed author from robertwb to Robert Bradshaw, Rob Beezer, William Stein

@rbeezer

This comment has been minimized.

@rbeezer
Copy link
Mannequin

rbeezer mannequin commented May 27, 2012

comment:7
  • Previous patches had the _numerical_approx function in the generic dense class, and specialized classes (such as rational dense) derive directly from the plain free module element class. Thus the method was invisible to those specialized classes and only "generic" vectors could use this. So I took William's version of the function and moved it up to a higher level.

    • Removed a pile of n() methods, but preserved many of their doctests in the new method.

    • Could not resist poking at the documentation of misc.functional.numerical_approx, so there was a drive-by upgrade there.

    • Improved the passing of prec and digits in one or two places.

    • Reworked the sparse case slightly and added a doctest to make sure it was not being clobbered.

    • Passes all tests.

    • Seemingly other places to look for removal, almost all outside my expertise. Maybe I should put these on a new ticket for safekeeping? The one for graphs is OK and does not need any inspection.

      sage: search_src('def n\(')
      modular/abvar/morphism.py:801:    def n(self):
      modules/vector_mod2_dense.pyx:447:    def n(self, *args, **kwargs):
      interfaces/qsieve.py:176:    def n(self):
      schemes/elliptic_curves/heegner.py:4386:    def n(self):
      schemes/elliptic_curves/ell_curve_isogeny.py:3468:    def n(self):
      
      sage: search_src('def N\(')
      modular/modsym/p1list.pyx:1165:    def N(self):
      modular/modsym/p1list_nf.py:261:    def N(self):
      modular/modsym/p1list_nf.py:642:    def N(self):
      modular/quatalg/brandt.py:534:    def N(self):
      graphs/generic_graph_pyx.pyx:356:def N(n):
      
      sage: search_src('def numerical_approx\(')
      misc/functional.py:1196:def numerical_approx(x, prec=None, digits=None):
      schemes/elliptic_curves/heegner.py:3127:    def numerical_approx(self, prec=53):
      schemes/elliptic_curves/heegner.py:3979:    def numerical_approx(self, prec=53):
      
      sage: search_src('def _numerical_approx\(')
      matrix/matrix2.pyx:10332:    def _numerical_approx(self,prec=None,digits=None):
      modules/free_module_element.pyx:991:    def _numerical_approx(self, prec=None, digits=None):
      modules/free_module_element.pyx:4361:    def _numerical_approx(self, prec=None, digits=None):
      symbolic/expression.pyx:4053:    def _numerical_approx(self, prec=None, digits=None):
      

@rbeezer rbeezer mannequin added s: needs work and removed s: positive review labels May 27, 2012
@dandrake
Copy link
Contributor

comment:9

Hello patchbot, please apply trac_12195-numerical-approx-v3.patch

Thank you

@dandrake
Copy link
Contributor

Changed reviewer from Rob Beezer, William Stein to Rob Beezer, William Stein, Dan Drake

@jdemeyer
Copy link

Merged: sage-5.1.beta4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants