-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
regression: conversion of Mathematica's Sqrt to Sage fails #31756
Comments
comment:1
Bisecting leads to #31047, which was merged in 9.3.rc0. |
This comment has been minimized.
This comment has been minimized.
comment:4
Cc'd myself and the participants to #31047. Another unrelated work (wrapping Sympy's symbolic logical functions) also showed the necessity of testing Maxima conversions bilaterally. |
comment:5
This is caused by the mathematica symbol table containing entries (for 'Sqrt' and 'Gamma') which are python functions but not of class Unfortunately, it is not easily possible to extend the sorting procedure to sort raw python functions into the function namespace, because sagemath variables are also callable objects. There are basically two ways to solve the problem:
|
comment:6
Replying to @spaghettisalat:
Thank you for the analysis. Indeed, the Gamma function is affected by this, as well. In the case of the Gamma function, I recall that this is intended: The function It is also possible to register new symbols, for example to convert custom functions from Mathematica to equivalent definitions in Sage, which could be Python functions. This still seems to work though.
Some of the functions in Sage's global namespace are also Python functions:
How about checking whether the object is callable and not an instance of |
This comment has been minimized.
This comment has been minimized.
comment:8
I was on the same track as
One might also plan to create proper Sage function wrappers around the current functions This might even be delegated to //Warning : diversion ahead...// I would be very interested in testing this "lite" solution because, I plan to propose to wrap Sympy's symbolic logical functions The Python operators
with
Writing a symbolic wrapper with
which, of course, fails to backtranslate in Sage :
[ Backtrace : snip... ]
Any hint about this problem in the Maxima interface would be very welcome... //End of diversion...// So I'm interested in your comments on |
Commit: |
Branch: u/gh-mwageringel/31756 |
Author: Markus Wageringel |
comment:9
Ok, here is a minimal fix that treats Python functions as functions as well. Please review. I have not tested the optional internet doctests because of SSL problems on my machine, but I assume that the current branch also fixes the errors mentioned on sage-release. (There is one unrelated but harmless Mathematica doctest failure in interfaces/mathematica.py, related to the recent html/latex changes, which I am going to fix in #29136.) New commits:
|
comment:10
Replying to @mwageringel:
[ Snip... ]
One concurring datapoint : without your patch, Python functions are ignored by Mathematia objects
whereas Sage's symbolic functions are not :
Testing your patch : stay tuned... |
comment:11
After rebasing your branch on Replying to @EmmanuelCharpentier:
[ Snip... ] A first cursory look is satisfying :
Similarly :
Now running |
comment:12
==> |
comment:13
Thank you. |
Reviewer: Emmanuel Charpentier |
comment:17
milestone to 9.4, as 9.3 has been released |
Changed branch from u/gh-mwageringel/31756 to |
This works with Sage 9.2, but fails with 9.3.rc4:
The result is an uppercase symbolic function, but should be the lowercase function
sqrt
in Sage.A doctest in interfaces/mathematica.py now fails:
This is also reproducible with
mathematica_free
, see this post on sage-release.This also affects the Gamma function:
CC: @seblabbe @EmmanuelCharpentier @nbruin @egourgoulhon @rwst @DaveWitteMorris
Component: interfaces
Keywords: mathematica
Author: Markus Wageringel
Branch/Commit:
6bacab2
Reviewer: Emmanuel Charpentier
Issue created by migration from https://trac.sagemath.org/ticket/31756
The text was updated successfully, but these errors were encountered: