Opened 5 years ago
Closed 5 years ago
#15970 closed defect (fixed)
j_invariant_qexp won't allow substitution
Reported by:  katestange  Owned by:  

Priority:  minor  Milestone:  sage6.3 
Component:  number theory  Keywords:  jinvariant, laurent series, qexpansion, substitution 
Cc:  Merged in:  
Authors:  Alex Ghitza  Reviewers:  Peter Bruin 
Report Upstream:  N/A  Work issues:  
Branch:  856e661 (Commits)  Commit:  856e6617de1d4ad26734d468f4ba43d8e3370388 
Dependencies:  Stopgaps: 
Description
jq = j_invariant_qexp(10) jqsub = jq.substitute(q = e^(2*pi))
This used to work (Sage 4.8). It ought to return an approximation to 1728 (this is useful behaviour...). E.g.
n(jqsub) 1727.99999999999
But now it raises...
ValueError: Can only substitute elements of positive valuation
Change History (10)
comment:1 Changed 5 years ago by
comment:2 followups: ↓ 3 ↓ 7 Changed 5 years ago by
Thanks, that clears things up for me. Probably I should have gone to the discussion list before opening a ticket (if so, I apologize). But before we close the ticket, can we clarify what way the user should accomplish the intended calculation? How can one approximate the jinvariant for various tau in the upper half plane? This is something Sage ought to allow someone to do, in some fashion, so if isn't possible, then maybe this ticket should be changed to a requested feature. But if this discussion ought to be carried out elsewhere (like ask.sagemath.org), please let me know.
comment:3 in reply to: ↑ 2 Changed 5 years ago by
Replying to katestange:
But before we close the ticket, can we clarify what way the user should accomplish the intended calculation? How can one approximate the jinvariant for various tau in the upper half plane?
For numerical computations, elliptic_j
will do:
sage: elliptic_j(I) 1728.00000000000
and the precision can be increased as in
sage: elliptic_j(sqrt(1).n(128)) 1728.0000000000000000000000000000000000
or
sage: tau = (1 + sqrt(163))/2 sage: elliptic_j(tau.n(100)) 2.6253741264076799999999999999e17 + 1.3012822400356849057448214481e12*I sage: (elliptic_j(tau.n(100)).real().round())^(1/3) 640320
comment:4 Changed 5 years ago by
Thank you!
comment:5 Changed 5 years ago by
 Branch set to u/AlexGhitza/ticket/15970
 Created changed from 03/18/14 04:21:35 to 03/18/14 04:21:35
 Modified changed from 03/20/14 15:09:34 to 03/20/14 15:09:34
comment:6 Changed 5 years ago by
 Commit set to 831373cb2b46477eb713b557765aa1439d1f627f
 Status changed from new to needs_review
I added a link to elliptic_j
in the docstring for j_invariant_qexp
.
New commits:
831373c  add reference to elliptic_j in j_invariant_qexp

comment:7 in reply to: ↑ 2 Changed 5 years ago by
Replying to katestange:
How can one approximate the jinvariant for various tau in the upper half plane? This is something Sage ought to allow someone to do, in some fashion, so if isn't possible, then maybe this ticket should be changed to a requested feature.
The request is of course a reasonable one. Sometimes all you have is a finite approximation, and evaluating that will be the best you'll get. The trick is to get rid of the O(..)
term, which you can do with truncate
:
sage: jq = j_invariant_qexp(10) sage: jq.truncate(100)(e^(2*pi)).n() 1727.99999999999
comment:8 Changed 5 years ago by
 Branch changed from u/AlexGhitza/ticket/15970 to u/pbruin/15970j_invariant_qexp
 Commit changed from 831373cb2b46477eb713b557765aa1439d1f627f to 856e6617de1d4ad26734d468f4ba43d8e3370388
 Reviewers set to Peter Bruin
 Status changed from needs_review to positive_review
Looks good, just a small reviewer patch to add markup to symbols and a variable name.
comment:9 Changed 5 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:10 Changed 5 years ago by
 Branch changed from u/pbruin/15970j_invariant_qexp to 856e6617de1d4ad26734d468f4ba43d8e3370388
 Resolution set to fixed
 Status changed from positive_review to closed
The change was made in #3979. Until Sage 5.4, substitution into power series was incorrectly implemented in many ways. In particular, it was possible to substitute a nonzero scalar into a series only specified up to a given precision, but this cannot make sense.
In your case,
gives the answer you want. But its meaning depends on assuming (correctly) that the infinitely many unspecified terms can be ignored (to within 10^{10}).
In general, writing, say,
tells us nothing about how
f(2)
should be defined, or whether6
might be a reasonable approximation.