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

fix conversion of sign function to fricas #31085

Closed
fchapoton opened this issue Dec 19, 2020 · 16 comments
Closed

fix conversion of sign function to fricas #31085

fchapoton opened this issue Dec 19, 2020 · 16 comments

Comments

@fchapoton
Copy link
Contributor

which apparently has no symbolic sign function

CC: @mantepse

Component: interfaces: optional

Keywords: FriCAS

Author: Frédéric Chapoton

Branch/Commit: 65695c1

Reviewer: Martin Rubey

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

@fchapoton
Copy link
Contributor Author

New commits:

9cdcb3ffix conversion of sign function to fricas

@fchapoton
Copy link
Contributor Author

Commit: 9cdcb3f

@fchapoton
Copy link
Contributor Author

Branch: u/chapoton/31085

@mantepse
Copy link
Collaborator

comment:2

I don't quite understand the patch. If you want a sign function for symbolic expressions in fricas, you'll have to use x/abs(x), I guess. But I don't think that fricas would be able to do anything with it. There is a sign function for integers and integer fractions, but I don't see the point of providing a translation, because it should never show up in a result that fricas provides.

@fchapoton
Copy link
Contributor Author

comment:3

I was trying the integral in #11590 with fricas, and it did not work. The existing conversion of the symbolic sign function is "sign", which cannot handle symbolic arguments.

But then apparently, Fricas cannot integrate functions containing abs.

@mantepse
Copy link
Collaborator

comment:4

Yes, that's correct (as far as I know).

So, do you think it makes sense to convert sign to x/abs(x)? (I don't)

@fchapoton
Copy link
Contributor Author

comment:5

Well, at least by converting to abs(x)/x (I prefer this way, and did that), one can go to fricas and back to sage without error. Why do you think that it's not a good idea ?

@mantepse
Copy link
Collaborator

comment:6

Sorry, I missed that! Yes, I agree with that! A doctest might be good, I'll try to think of one.

@mantepse
Copy link
Collaborator

Reviewer: Martin Rubey

@mantepse
Copy link
Collaborator

Changed keywords from none to FriCAS

@mantepse
Copy link
Collaborator

comment:9

Here is a trival test, do you want to add it?

sage: fricas(sign(x)).eval(x=-3)
- 1

Other than that, it looks good. There is currently a giac failure, which I cannot say anything about.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 21, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

65695c1add a doctest for fricas sign

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 21, 2020

Changed commit from 9cdcb3f to 65695c1

@fchapoton
Copy link
Contributor Author

comment:11

Voilà !

@mantepse
Copy link
Collaborator

comment:12

Great, looks good. I cannot reproduce the giac failure, I guess it's unrelated.

@vbraun
Copy link
Member

vbraun commented Dec 27, 2020

Changed branch from u/chapoton/31085 to 65695c1

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

3 participants