Opened 3 months ago
Last modified 3 weeks ago
#28647 needs_review defect
conversion of Symbolic Ring to FriCAS Expression Integer
Reported by:  mantepse  Owned by:  

Priority:  major  Milestone:  sage9.1 
Component:  interfaces: optional  Keywords:  FriCAS 
Cc:  chapoton  Merged in:  
Authors:  Martin Rubey  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  u/mantepse/conversion_of_symbolic_ring_to_fricas_expression_integer (Commits)  Commit:  09bee2611190ef2d5071427ac69b6a8927e4fece 
Dependencies:  Stopgaps: 
Description (last modified by )
This ticket modifies the FriCAS interface so that symbolic ring elements are always converted to FriCAS Expression Integer
or Expression Complex Integer
, depending on whether the complex unit appears. Doing so, we fix the failure below.
see https://ask.sagemath.org/question/48431/whythisintegralfailusingfricasalgorithm/
for the original bug report:
integrate(sqrt(2)*x^2 + 2*x,x, algorithm="fricas")
Change History (17)
comment:1 Changed 3 months ago by
 Branch set to u/mantepse/conversion_of_symbolic_ring_to_fricas_expression_integer
comment:2 Changed 3 months ago by
 Cc chapoton added
 Commit set to 4c672a0d25b00b0f33c873a71164d5b6e6ac5916
 Component changed from PLEASE CHANGE to interfaces: optional
 Description modified (diff)
 Status changed from new to needs_review
 Type changed from PLEASE CHANGE to defect
comment:3 followup: ↓ 4 Changed 3 months ago by
Possible collision with #28641 which refers to the same ask.sagemath.org question.
comment:4 in reply to: ↑ 3 Changed 3 months ago by
comment:5 Changed 3 months ago by
some failing doctests in src/sage/functions/generalized.py and src/sage/functions/exp_integral.py
comment:6 Changed 3 months ago by
There are unfortunately more problems. In particular, fricas(I)
calls FriCASConverter.pyobject(I, I)
(as it should). But this now returns I
instead of %i
.
comment:7 Changed 3 months ago by
I'm afraid my approach won't work, because FriCAS distinguishes between Expression Integer
and Expression Complex Integer
.
Put differently, the complex unit I
is not an element of Expression Integer
, but would have to be expressed as sqrt(1)
. I see the following options:
 rewrite
I
assqrt(1)
,  always use
Expression Complex Integer
,  detect whether
I
appears and distinguish accordingly,  somehow let FriCAS decide
I tend towards option 1., but I am not sure at all.
comment:9 Changed 2 months ago by
 Commit changed from 4c672a0d25b00b0f33c873a71164d5b6e6ac5916 to 8948d3883678895a95fcc67f72801375e3f23832
Branch pushed to git repo; I updated commit sha1. New commits:
8948d38  try to fix conversion of complex expressions to fricas

comment:10 Changed 2 months ago by
 Description modified (diff)
 Status changed from needs_work to needs_review
comment:11 Changed 2 months ago by
 Status changed from needs_review to needs_work
I think I have to make an exception for the conversion of symbols, because otherwise fricas.integrate(ex, x)
won't work anymore.
comment:12 Changed 2 months ago by
 Commit changed from 8948d3883678895a95fcc67f72801375e3f23832 to d1b449088d9423f1f8faadd0d6e09a1ed873ca30
Branch pushed to git repo; I updated commit sha1. New commits:
8601700  fix doctests

4205759  Merge branch 'u/mantepse/conversion_of_symbolic_ring_to_fricas_expression_integer' of git://trac.sagemath.org/sage into t/28647/conversion_of_symbolic_ring_to_fricas_expression_integer

d1b4490  Merge branch 'develop' into t/28647/conversion_of_symbolic_ring_to_fricas_expression_integer

comment:13 Changed 2 months ago by
 Keywords FriCAS added
comment:14 Changed 2 months ago by
 Commit changed from d1b449088d9423f1f8faadd0d6e09a1ed873ca30 to b95f2a46b2a7eecdc3c42d042fae1031b3ade548
Branch pushed to git repo; I updated commit sha1. New commits:
b95f2a4  make an exception for symbols

comment:15 Changed 2 months ago by
 Status changed from needs_work to needs_review
comment:16 Changed 2 months ago by
 Commit changed from b95f2a46b2a7eecdc3c42d042fae1031b3ade548 to 09bee2611190ef2d5071427ac69b6a8927e4fece
Branch pushed to git repo; I updated commit sha1. New commits:
09bee26  fix doctests

comment:17 Changed 3 weeks ago by
 Milestone changed from sage9.0 to sage9.1
Ticket retargeted after milestone closed
New commits:
make sagemath SR convert to FriCAS EXPR INT