Opened 11 years ago

Closed 7 years ago

#8348 closed enhancement (fixed)

Document that find_root only works in fixed (double) precision

Reported by: zimmerma Owned by: AlexGhitza
Priority: major Milestone: sage-6.2
Component: basic arithmetic Keywords:
Cc: was Merged in:
Authors: Paul Zimmermann Reviewers: Marc Mezzarobba
Report Upstream: N/A Work issues:
Branch: u/mmezzarobba/8348-find_root_doc Commit: 98bdbcc7f617ca2015b984e1b4f0412cc586fa99
Dependencies: Stopgaps:

Status badges

Description

How can one approximate the root of an equation in arbitrary precision? For example I want the root of log(x+2) = x to 50 digits of precision:

sage: (log(x+2)-x).find_root(1,2)
1.1461932206205643
sage: (log(x+2)-x).find_root(1,2,prec=150)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/users/caramel/zimmerma/try/<ipython console> in <module>()

/usr/local/sage-core2/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.find_root (sage/symbolic/expression.cpp:24383)()

TypeError: find_root() got an unexpected keyword argument 'prec'

Attachments (1)

trac_8348.patch (2.0 KB) - added by zimmerma 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by zimmerma

  • Cc was added

comment:2 Changed 11 years ago by jason

  • Type changed from defect to enhancement

This is about adding capability not currently present, so should be an enhancement.

comment:3 Changed 11 years ago by zimmerma

This is about adding capability not currently present, so should be an enhancement.

I do not agree. The documentation does not say that find_root only works in double precision, thus this is a defect (at least of the documentation). Do you agree with that?

comment:4 Changed 11 years ago by jason

  • Summary changed from find_root only works in fixed (double) precision to Document that find_root only works in fixed (double) precision
  • Type changed from enhancement to defect

The docs for find_root don't imply that it uses arbitrary precision to me, so I agree it's an omission, but not a bug (i.e., it doesn't claim one thing and do another). The only mention of precision in the docs (in the xtol and rtol parameters) implies that things work with double precision.

But this is a minor point. I was trying to clean up the large number of tickets that are classified as "bugs" (which to me means things that Sage claims should work, but don't).

In this case, the error returned indicates that find_root knows nothing about a prec argument, which is appropriate.

I've switched it back so we don't waste any more time fretting about how to classify this ticket.

comment:5 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

Changed 8 years ago by zimmerma

comment:6 follow-up: Changed 8 years ago by zimmerma

  • Authors set to Paul Zimmermann
  • Status changed from new to needs_review
  • Type changed from defect to enhancement

the attached patch (produced against Sage 5.9) adds documentation to find_root. Note: I found out that find_root is duplicated in numerical/optimize.py and in symbolic/expression.pyx, which is unfortunate.

Paul

comment:7 in reply to: ↑ 6 Changed 7 years ago by mmezzarobba

  • Branch set to u/mmezzarobba/8348-find_root_doc
  • Commit set to 98bdbcc7f617ca2015b984e1b4f0412cc586fa99
  • Reviewers set to Marc Mezzarobba
  • Status changed from needs_review to positive_review

LGTM.

Replying to zimmerma:

Note: I found out that find_root is duplicated in numerical/optimize.py and in symbolic/expression.pyx, which is unfortunate.

Only (part of) the documentation is duplicated; one of the function is a wrapper for the other. It is unfortunate indeed, but that's a problem that occurs everywhere in Sage, so I don't think it really makes sense to open a ticket for that particular instance.


New commits:

98bdbcc#8348: Document that find_root only works in fixed (double) precision

comment:8 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:9 Changed 7 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.