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

Make elliptic_j function symbolic #15354

Closed
sagetrac-davidamadore mannequin opened this issue Nov 4, 2013 · 4 comments
Closed

Make elliptic_j function symbolic #15354

sagetrac-davidamadore mannequin opened this issue Nov 4, 2013 · 4 comments

Comments

@sagetrac-davidamadore
Copy link
Mannequin

sagetrac-davidamadore mannequin commented Nov 4, 2013

Sage's elliptic_j function does not behave similarly to the other standard or special functions: it tries to numerically evaluate instead of building a symbolic expression:

sage: elliptic_j(I)
1728.00000000000
sage: elliptic_j(x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
...
TypeError: Cannot evaluate symbolic expression to a numeric value.

This is very weird: it means, for example, that plot(real(elliptic_j(x+I)), (x,0,1)) will fail (instead, one must use plot(lambda t: real(elliptic_j(t+I)), (0,1)))

Component: symbolics

Keywords: special function, elliptic

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

@sagetrac-davidamadore sagetrac-davidamadore mannequin added this to the sage-6.1 milestone Nov 4, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@jdemeyer jdemeyer changed the title elliptic_j function should not compute numerically unless asked for Make elliptic_j function symbolic Jun 27, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@rwst
Copy link

rwst commented Dec 9, 2014

Changed keywords from special function to special function, elliptic

@rwst

This comment has been minimized.

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
@grhkm21
Copy link
Contributor

grhkm21 commented Feb 14, 2024

I looked at this just now, it doesn't seem too trivial, as the current implementation actually calls pari:

    CC = z.parent()
    if not isinstance(CC, sage.rings.abc.ComplexField):
        from sage.rings.complex_mpfr import ComplexField
        CC = ComplexField(prec)
        try:
            z = CC(z)
        except ValueError:
            raise ValueError("elliptic_j only defined for complex arguments.")
    from sage.libs.pari.all import pari
    return CC(pari(z).ellj())

I'm not sure how you can represent the function symbolically either, since it is transcendental in general. However, it will be nice for the function to be exact when the argument is an exact imaginary quadratic term. I will open an issue for that. Other than that, I will close the issue for now, if anyone has a better idea feel free to reopen.

@user202729
Copy link
Contributor

@grhkm21 Old issue but it can certainly be represented symbolically. I guess the issue can be kept as a tracking issue.

For example with gamma:

sage: gamma(5)
24
sage: gamma(5, hold=True)
gamma(5)

(Though I don't understand enough about how Sage represents symbolic expression in general, I think the symbolic expression tree must be recognize-able by Maxima for things like e.g. simplify() to work? Through a cursory search Maxima doesn't seem to have modular form.)

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

4 participants