Opened 4 years ago

Closed 3 years ago

#15057 closed enhancement (fixed)

SymPy conversions for symbolic functions that are missing them

Reported by: eviatarbach Owned by:
Priority: major Milestone: sage-6.4
Component: symbolics Keywords:
Cc: burcin, asmeurer Merged in:
Authors: Eviatar Bach Reviewers: Ralf Stephan
Report Upstream: N/A Work issues:
Branch: 341de9a (Commits) Commit: 341de9a2f88d2195cccf83204357a456c6bdd62c
Dependencies: Stopgaps:

Description

Some symbolic functions are missing SymPy? conversions.

Attachments (3)

trac15057.patch (5.5 KB) - added by eviatarbach 4 years ago.
trac15057_2.patch (7.5 KB) - added by eviatarbach 4 years ago.
trac15057_3.patch (13.1 KB) - added by eviatarbach 4 years ago.

Download all attachments as: .zip

Change History (24)

Changed 4 years ago by eviatarbach

comment:1 Changed 4 years ago by eviatarbach

  • Cc burcin added
  • Status changed from new to needs_review

The patch adds conversions for all the symbolic functions in Sage that I could find that have a SymPy? equivalent.

Patchbot apply trac15057.patch​

comment:2 Changed 4 years ago by eviatarbach

  • Cc asmeurer added

comment:3 Changed 4 years ago by asmeurer

You must be using an old version of SymPy?. KroneckerDelta? is just KroneckerDelta?. The rest look fine.

Changed 4 years ago by eviatarbach

comment:4 Changed 4 years ago by eviatarbach

Ah, alright. I was using 0.7.1, which is the version currently in Sage. This should be merged after #14694 then. I also added doctests in case the names change again in the future.

comment:5 Changed 4 years ago by eviatarbach

  • Dependencies set to #14694

comment:6 Changed 4 years ago by asmeurer

A bunch of new special functions have been added since then too, so this is probably not complete.

comment:7 Changed 4 years ago by eviatarbach

I think I checked fairly thoroughly (I believe that I automatically ran through all the functions in sage/functions and tried to call their _sympy_ method, and if it failed I checked if there was a SymPy? equivalent), and with the current SymPy? documentation. I may have missed a few though.

comment:8 Changed 4 years ago by asmeurer

Can you provide the list of functions without equivalents?

comment:9 Changed 4 years ago by eviatarbach

Actually, I didn't include the conversions for the exponential integrals and lambert_w. Patch for that coming up.

Here are the functions in Sage that are not in SymPy? as far as I can tell. I haven't checked the ones in sage/rings/arith.py yet, and of course there are tons of combinatorial functions.

  • Dickman's function (dickman_rho in Sage)
  • Heaviside step function and unit step function (heaviside and unit_step in Sage; they only seem to differ in that heaviside is undefined at 0)
  • Inverse Jacobi functions (inverse_jacobi in Sage)
  • Jacobi amplitude function (to be added in #14996 as jacobi_am)
  • Spherical Bessel and spherical Hankel functions (spherical_bessel_J, spherical_bessel_Y, spherical_hankel1, and spherical_hankel2 in Sage)
  • Symmetric zeta function (zeta_symmetric in Sage)
  • Derivatives of the zeta function (zetaderiv in Sage)

Note that some SymPy? conversions are going to be added in pending tickets that transition functions to use Sage's BuiltinFunction instead of being simple Maxima wrappers. For example, #15046 and #14996.

comment:10 Changed 4 years ago by asmeurer

SymPy? has Heaviside, which gives 1/2 at 0. It also has (I believe all) the bessel functions (I don't remember, but some of them may be new in the most recent version).

I opened https://code.google.com/p/sympy/issues/detail?id=3992 to implement the rest :)

comment:11 Changed 4 years ago by eviatarbach

Right, the spherical Bessel functions are implemented, but not the spherical Hankel functions. They're not in mpmath, but numeric evaluation is quite trivial to implement; see the function spherical_bessel_f at http://trac.sagemath.org/attachment/ticket/15024/trac15024.patch.

Last edited 4 years ago by eviatarbach (previous) (diff)

comment:12 Changed 4 years ago by eviatarbach

This patch adds conversions for exponential integrals as well. I didn't add a Lambert W conversion since it has a different number of arguments in SymPy? (Sage allows you to choose the branch), and there doesn't seem to be a good way of doing more complicated conversions yet. It should be easy to add functionality for doing so, however.

Changed 4 years ago by eviatarbach

comment:13 Changed 4 years ago by eviatarbach

Apparently SymPy? doesn't have Jacobi elliptic functions at all. That's another one to add to the list.

comment:14 Changed 4 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:15 Changed 3 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:16 Changed 3 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:17 Changed 3 years ago by rws

See also #14723

comment:18 Changed 3 years ago by rws

  • Branch set to u/rws/sympy_conversions_for_symbolic_functions_that_are_missing_them

comment:19 Changed 3 years ago by rws

  • Authors set to Eviatar Bach
  • Commit set to 341de9a2f88d2195cccf83204357a456c6bdd62c
  • Reviewers set to Ralf Stephan
  • Status changed from needs_review to positive_review

It's all straightforward addition of conversions. Long doctests pass in functions.


New commits:

2c7174f15057: Adding SymPy conversions, with reviewer's additions
341de9a15057: fix typo

comment:20 Changed 3 years ago by vbraun

  • Dependencies #14694 deleted

My release management script doesn't understand dependencies that predate the git transition ;-)

comment:21 Changed 3 years ago by vbraun

  • Branch changed from u/rws/sympy_conversions_for_symbolic_functions_that_are_missing_them to 341de9a2f88d2195cccf83204357a456c6bdd62c
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.