Opened 2 years ago

Closed 22 months ago

Last modified 22 months ago

#25602 closed defect (fixed)

implement translation of fricas.rootOf

Reported by: mantepse Owned by:
Priority: major Milestone: sage-8.4
Component: interfaces: optional Keywords: FriCAS
Cc: gh-nasser1, rws, arojas Merged in:
Authors: Martin Rubey Reviewers: Dima Pasechnik, Eric Gourgoulhon
Report Upstream: N/A Work issues:
Branch: 4539a94 (Commits) Commit:
Dependencies: Stopgaps:

Description

sage: var('x')
sage: fricas.setSimplifyDenomsFlag(fricas.true)
sage: integrate(sqrt(x + sqrt(x + 1))/((x^2 + 1)*sqrt(x + 1)),x,algorithm="fricas")

sage: integrate(sqrt(x + sqrt(x + 1))/(x^2 + 1),x, algorithm="fricas")

yield NotImplementedErrors, because FriCAS returns results containing rootOf expressions.

See https://groups.google.com/forum/#!topic/fricas-devel/aV7uLH8plZM

Change History (43)

comment:1 Changed 2 years ago by mantepse

  • Type changed from PLEASE CHANGE to defect

comment:2 Changed 2 years ago by mantepse

  • Keywords FriCAS added

comment:3 Changed 2 years ago by mantepse

  • Cc gh-nasser1 added

Nasser, do you happen to have a simple integration result containing a rootOf? This would be really helpful for testing purposes!

comment:4 Changed 2 years ago by gh-nasser1

I searched my tests files, and do not see a "simple" result. Each of these integrals below generate rootOf when running them in Fricas. But they all produce large results I am afraid. But these should be useful to test your conversion with.

integrate(1/(-1/x^(1/3)+x^(1/2)),x)
integrate(x^(1/2)/(-1/x^(1/3)+x^(1/2)),x)
integrate((x+(1+x)^(1/2))^(1/2)/(x^2+1)/(1+x)^(1/2),x)
integrate((x+(1+x)^(1/2))^(1/2)/(x^2+1),x)
integrate(1/(a^5+x^5),x)
integrate(x^2/(a^5+x^5),x)
integrate(x^3/(a^5+x^5),x)
integrate(1/x^2/(a^5+x^5),x)
integrate(1/x^3/(a^5+x^5),x)
integrate(1/x^4/(a^5+x^5),x)
integrate(x^6/(2*x^5+3)^3,x)
integrate(tan(x)/(-1+tan(x)^(1/2))^2,x)

comment:5 Changed 2 years ago by mantepse

This was very helpful! I've now got something if no variables are involved, however, I am not sure how helpful it is. For example:

sage: f = 1/(1+x^5)
sage: F = fricas.integrate(f, x).sage(); F
(0.06180339887498948? + 0.1902113032590308?*I)*log(2*x + 0.618033988749895? + 1.902113032590308?*I) + (0.06180339887498948? - 0.1902113032590308?*I)*log(2*x + 0.618033988749895? - 1.902113032590308?*I) + 1/5*log(x + 1) - (0.1618033988749895? - 0.11755705045849462?*I)*log(x - 0.8090169943749474? + 0.5877852522924731?*I) - (0.1618033988749895? + 0.11755705045849462?*I)*log(x - 0.8090169943749474? - 0.5877852522924731?*I)

(I checked the solution, it is correct.)

comment:6 Changed 2 years ago by mantepse

Just found out that QQbar can try to find an expression in terms of radicals. The output will be terrible, in general:

sage: F = fricas.integrate(f, x).sage(); F
1/20*(sqrt(5) + 2*sqrt(-3/16*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 - 1/8*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) - 3)*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1) - 3/16*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 + 1/2*sqrt(5) + 5*sqrt(1/50*sqrt(5) - 1/10) - 5/2) - 1)*log(2*x + 1/2*sqrt(5) + sqrt(-3/16*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 - 1/8*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) - 3)*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1) - 3/16*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 + 1/2*sqrt(5) + 5*sqrt(1/50*sqrt(5) - 1/10) - 5/2) - 1/2) + 1/20*(sqrt(5) - 2*sqrt(-3/16*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 - 1/8*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) - 3)*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1) - 3/16*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 + 1/2*sqrt(5) + 5*sqrt(1/50*sqrt(5) - 1/10) - 5/2) - 1)*log(2*x + 1/2*sqrt(5) - sqrt(-3/16*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 - 1/8*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) - 3)*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1) - 3/16*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1)^2 + 1/2*sqrt(5) + 5*sqrt(1/50*sqrt(5) - 1/10) - 5/2) - 1/2) - 1/20*(sqrt(5) - 10*sqrt(1/50*sqrt(5) - 1/10) + 1)*log(x - 1/4*sqrt(5) + 5/2*sqrt(1/50*sqrt(5) - 1/10) - 1/4) - 1/20*(sqrt(5) + 10*sqrt(1/50*sqrt(5) - 1/10) + 1)*log(x - 1/4*sqrt(5) - 5/2*sqrt(1/50*sqrt(5) - 1/10) - 1/4) + 1/5*log(x + 1)
sage: F.simplify_full()
1/20*(sqrt(2)*sqrt(sqrt(5) - 5) - sqrt(5) - 1)*log(1/8*sqrt(2)*(4*sqrt(2)*x - sqrt(5)*sqrt(2) - sqrt(2) + 2*sqrt(sqrt(5) - 5))) - 1/20*(sqrt(2)*sqrt(sqrt(5) - 5) + sqrt(5) + 1)*log(1/8*sqrt(2)*(4*sqrt(2)*x - sqrt(5)*sqrt(2) - sqrt(2) - 2*sqrt(sqrt(5) - 5))) + 1/20*(sqrt(5) + 2*sqrt(-1/2*sqrt(5) - 5/2) - 1)*log(2*x + 1/2*sqrt(5) + sqrt(-1/2*sqrt(5) - 5/2) - 1/2) + 1/20*(sqrt(5) - 2*sqrt(-1/2*sqrt(5) - 5/2) - 1)*log(2*x + 1/2*sqrt(5) - sqrt(-1/2*sqrt(5) - 5/2) - 1/2) + 1/5*log(x + 1)

comment:7 follow-up: Changed 2 years ago by gh-nasser1

I do not think you'd want to actually evaluate numerically the roots as in your first example above.

I think fricas uses rootOf when it can't solve for the root analytically (as in polynomials for higher order than 4, where there is no formula in general).

I've seen Mathematica also return RootOf? for some results. The user can then obtain numerical values for the result if they want to afterwords. But for a symbolic integration, the result should always be returned as symbolic, with no floating point numbers. So your second example above would be much better to use.

btw, For this example, Mathematica gives

Integrate[1/(1+x^5),x]

(1/20)*(-2*Sqrt[10 - 2*Sqrt[5]]*ArcTan[(1 + Sqrt[5] - 4*x)/Sqrt[10 - 2*Sqrt[5]]] + 
   2*Sqrt[2*(5 + Sqrt[5])]*ArcTan[(-1 + Sqrt[5] + 4*x)/Sqrt[2*(5 + Sqrt[5])]] + 4*Log[1 + x] + 
   (-1 + Sqrt[5])*Log[1 + (1/2)*(-1 + Sqrt[5])*x + x^2] - 
   (1 + Sqrt[5])*Log[1 - (1/2)*(1 + Sqrt[5])*x + x^2])

Thank you --Nasser

comment:8 Changed 2 years ago by mantepse

  • Branch set to u/mantepse/implement_translation_of_fricas_rootof

comment:9 in reply to: ↑ 7 Changed 2 years ago by mantepse

  • Commit set to 84c392e413ef4515ab4e4d3e5e17d6e54c930ef2

Replying to gh-nasser1:

I do not think you'd want to actually evaluate numerically the roots as in your first example above.

Note that the result is not numeric, the coefficients are in QQbar. They are exact, only an approximation is printed.

Anyway, I don't know whether sage has a "symbolic" rootOf equivalent. On the positive side, it is then possible to evaluate integration results numerically.

To deal with integration results containing additional variables, a little more work is needed.


New commits:

84c392efirst version of translation of rootOf

comment:10 Changed 2 years ago by git

  • Commit changed from 84c392e413ef4515ab4e4d3e5e17d6e54c930ef2 to a983d7a55150a8fd566dbb7f4097e001721500d5

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

a983d7atranslate rootOf also when extra variables are present

comment:11 Changed 2 years ago by mantepse

  • Status changed from new to needs_review

comment:12 Changed 2 years ago by mantepse

  • Cc rws added

comment:13 Changed 2 years ago by git

  • Commit changed from a983d7a55150a8fd566dbb7f4097e001721500d5 to becb3681d2f24a47e68902a69c712b172bb96294

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

becb368fix doctests

comment:14 Changed 2 years ago by mantepse

@gh-nasser1: dear Nasser, could you please check whether this works for you now? (it was actually a fair bit of work, so I'd rather get back to it now than later)

Please test especially integrals with parameters (that is, extra variables) showing up in the rootOf expressions.

comment:15 follow-up: Changed 2 years ago by mantepse

ping?

comment:16 in reply to: ↑ 15 ; follow-up: Changed 2 years ago by gh-nasser1

Replying to mantepse:

ping?

Hi, sorry, I am not familar with github and did not know I need to do anything. I did not see this.

What exactly you want me to do when you say to see if it works?

How do I test your changes? Do I need to reinstall sagemath from Manjaro AUR again? It is still at 8.3 beta 6 last I checked Which is the one I am using now. Or is there a newer version to use?

I am complete newbie in github and of this. Only way I know, is to use Manjaro GUI package manager to install sagemath.

Last edited 2 years ago by gh-nasser1 (previous) (diff)

comment:17 in reply to: ↑ 16 Changed 2 years ago by mantepse

Hi Nasser!

To get these changes into sage (eg., 8.3. beta 8), someone has to "review" them, that is, make sure that they are correct. You can contribute to a review by stating here that you tried the modified code and that it works for you, for example, trying it on further integrals.

To be able to try the code, you have to install sage using git, because, of course, the changes are not yet in sage.

If you only want to review (as opposed to submitting code yourself), you have to do the things from http://doc.sagemath.org/html/en/developer/walk_through.html in sections

  • Configuring Git
  • Obtaining the Sage Source Code

and then (from http://doc.sagemath.org/html/en/developer/git_trac.html)

  • Installing the Git-Trac Command
  • Git and Trac Configuration
  • Reviewing

If that works for you, that would be great!

comment:18 Changed 2 years ago by gh-nasser1

Hello;

I am sorry, this is all over my head. I do not know what sage trac and how to install git and do not know how to build sage myself from sources and any of this. Never used these before.

I installed sage by clicking on a button using Linux package manager. It did everything.

I am not really in a position or have knowledge now to go through such steps you described above.

When I find a new bug using sage, I'll report it here and leave Experts like yourself to handle the rest.

I'll be happy to install a new version of sagemath when new one is released and run the tests. I check the Linux package manager to find out.

Thank you

Last edited 2 years ago by gh-nasser1 (previous) (diff)

comment:19 Changed 2 years ago by mantepse

No problem, Nasser!

comment:20 Changed 2 years ago by gh-nasser1

Hello; fyi, I tried these in new installed sagemath 8.3 beta 7, Release Date: 2018-06-23, using AUR package manager of Linux Manjaro.

They still generate " not yet implemented" for rootOf.

I will check again when a new version of sagemath is released.

Thank you

comment:21 follow-up: Changed 2 years ago by gh-nasser1

Hello; fyi, I tried these in new build and installed sagemath 8.3 beta 8,

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.beta8, Release Date: 2018-06-30               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘

Using AUR package manager of Linux Manjaro.

They still generate "not yet implemented" for rootOf.

I will check again when a new version of sagemath is released.

Thank you

comment:22 in reply to: ↑ 21 Changed 2 years ago by rws

Replying to gh-nasser1:

They still generate "not yet implemented" for rootOf.

Nasser, this ticket is "needs review", maybe you can review? See http://doc.sagemath.org/html/en/developer/index.html#sage-trac-and-tickets

You can always try out the code here by building Sage from source, see http://doc.sagemath.org/html/en/installation/source.html

Working with binary only will never get you the newest code, be it Sage or other programs. Moreover, open source means there are opportunites to help, to give back. Try it.

comment:23 Changed 23 months ago by mantepse

ping?

comment:24 Changed 23 months ago by gh-nasser1

Hello,

If the ping is meant for me, please note, as I mentioned above, I can only try with current version of sagemath, which I update each time a new one comes out using Arch Linux package manager on Linux Manjaro.

I do not know how to build sagemath from GIT sources or use git.

For SageMath version 8.3.rc2, Release Date: 2018-07-22 the NotImplementedError error is still there for rootOf

Thanks --Nasser

comment:25 Changed 22 months ago by egourgoulhon

LGTM.

It would be nice however if you could correct the pyflake errors reported in this patchbot log.

comment:26 Changed 22 months ago by dimpase

  • Milestone changed from sage-8.3 to sage-8.4

comment:27 Changed 22 months ago by dimpase

  • Branch changed from u/mantepse/implement_translation_of_fricas_rootof to public/fricas/rootof
  • Commit changed from becb3681d2f24a47e68902a69c712b172bb96294 to 4539a940848397eb8113f0e889db231e0dac91dc
  • Reviewers set to Dima Pasechnik

this fixes pyflake errors


New commits:

f973985Merge branch 'u/mantepse/implement_translation_of_fricas_rootof' of https://github.com/sagemath/sagetrac-mirror into sage83
4539a94fix pyflake errors

comment:28 Changed 22 months ago by dimpase

if this works for you, please set it to positive review

comment:29 Changed 22 months ago by mantepse

Great! Yes, I rebuilt and all test still pass. (My intention was to fix the pyflakes stuff in a separate ticket, but I am very happy if they are already fixed now.)

Not sure whether "you" is me or Eric, so I am not taking action...

comment:30 Changed 22 months ago by egourgoulhon

  • Reviewers changed from Dima Pasechnik to Dima Pasechnik, Eric Gourgoulhon
  • Status changed from needs_review to positive_review

Thanks to both of you!

comment:31 Changed 22 months ago by vbraun

  • Branch changed from public/fricas/rootof to 4539a940848397eb8113f0e889db231e0dac91dc
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:32 Changed 22 months ago by gh-nasser1

  • Commit 4539a940848397eb8113f0e889db231e0dac91dc deleted

fyi, I just tried this again in version 8.4.beta1, Release Date: 2018-08-14 to see if the RootOf? translation is fixed in this version or not to rerun my tests.

But now I get a new error for the same command posted in the original ticket above. Instead of getting NotImplementedError? Sagemath now gives

RuntimeError: ECL says: Filesystem error with pathname #P"/usr/lib/ecl/maxima.fas".
Either
 1) the file does not exist, or
 2) we are not allowed to access the file, or
 3) the pathname points to a broken symbolic link.

Here is the full command

sage:  var('x')
x
sage: fricas.setSimplifyDenomsFlag(fricas.true)
false
sage: integrate(sqrt(x + sqrt(x + 1))/(x^2 + 1),x, algorithm="fricas")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-0a653d27d8c0> in <module>()
----> 1 integrate(sqrt(x + sqrt(x + Integer(1)))/(x**Integer(2) + Integer(1)),x, algorithm="fricas")

/usr/lib/python2.7/site-packages/sage/misc/functional.py in integral(x, *args, **kwds)
    751     """
    752     if hasattr(x, 'integral'):
--> 753         return x.integral(*args, **kwds)
    754     else:
    755         from sage.symbolic.ring import SR

/usr/lib/python2.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.integral (build/cythonized/sage/symbolic/expression.cpp:69786)()
  12371                     R = ring.SR
  12372             return R(integral(f, v, a, b, **kwds))
> 12373         return integral(self, *args, **kwds)
  12374 
  12375     integrate = integral

/usr/lib/python2.7/site-packages/sage/symbolic/integration/integral.py in integrate(expression, v, a, b, algorithm, hold)
    814         if not integrator:
    815             raise ValueError("Unknown algorithm: %s" % algorithm)
--> 816         return integrator(expression, v, a, b)
    817     if a is None:
    818         return indefinite_integral(expression, v, hold=hold)

/usr/lib/python2.7/site-packages/sage/symbolic/integration/external.py in fricas_integrator(expression, v, a, b, noPole)
    189                          " in the integration interval")
    190 
--> 191     return result.sage()
    192 
    193 

/usr/lib/python2.7/site-packages/sage/interfaces/interface.py in sage(self, *args, **kwds)
   1049             [0 0]
   1050         """
-> 1051         return self._sage_(*args, **kwds)
   1052 
   1053     def __repr__(self):

/usr/lib/python2.7/site-packages/sage/interfaces/fricas.py in _sage_(self)
   1496             # we treat Expression Integer and Expression Complex
   1497             # Integer just the same
-> 1498             return self._sage_expression(unparsed_InputForm)
   1499 
   1500         if head == 'DistributedMultivariatePolynomial':

/usr/lib/python2.7/site-packages/sage/interfaces/fricas.py in _sage_expression(self, unparsed_InputForm)
   1241                     poly = R(poly.subs({var:R.gen()}))
   1242                     # we just need any root per FriCAS specification
-> 1243                     rootOf_ev[var] = poly.roots(multiplicities=False)[0].radical_expression()
   1244                 del rootOf[var]
   1245                 i = 0

/usr/lib/python2.7/site-packages/sage/rings/qqbar.py in radical_expression(self)
   3939         else:
   3940             interval_field = ComplexIntervalField(self._value.prec())
-> 3941         roots = poly.roots(SR, multiplicities=False)
   3942         if len(roots) != poly.degree():
   3943             return self

/usr/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:69120)()
   7731             var = SR(vname)
   7732             expr = self(var)
-> 7733             rts = expr.solve(var,
   7734                              explicit_solutions=True,
   7735                              multiplicities=multiplicities)

/usr/lib/python2.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.solve (build/cythonized/sage/symbolic/expression.cpp:64716)()
  11548         """
  11549         from sage.symbolic.relation import solve
> 11550         return solve(self, x, multiplicities=multiplicities,
  11551                               solution_dict=solution_dict,
  11552                               explicit_solutions=explicit_solutions,

/usr/lib/python2.7/site-packages/sage/symbolic/relation.py in solve(f, *args, **kwds)
   1043 
   1044     if is_Expression(f): # f is a single expression
-> 1045         return _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain)
   1046 
   1047     if not isinstance(f, (list, tuple)):

/usr/lib/python2.7/site-packages/sage/symbolic/relation.py in _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain)
   1281 
   1282     # from here on, maxima is used for solution
-> 1283     m = ex._maxima_()
   1284     P = m.parent()
   1285     if explicit_solutions:

/usr/lib/python2.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:8054)()
    815             # Maybe not such a great idea because the "default" interface is another one
    816             from sage.calculus.calculus import maxima
--> 817             return super(Expression, self)._interface_(maxima)
    818         else:
    819             return super(Expression, self)._interface_(session)

/usr/lib/python2.7/site-packages/sage/structure/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:5636)()
    732             except (KeyError, ValueError):
    733                 pass
--> 734         nm = I.name()
    735         init_func = getattr(self, '_%s_init_' % nm, None)
    736         if init_func is not None:

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3609)()
    320             True
    321         """
--> 322         return getattr(self.get_object(), attr)
    323 
    324     # We need to wrap all the slot methods, as they are not forwarded

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.get_object (build/cythonized/sage/misc/lazy_import.c:2270)()
    187         if likely(self._object is not None):
    188             return self._object
--> 189         return self._get_object()
    190 
    191     cpdef _get_object(self):

/usr/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2535)()
    219         elif self._at_startup and not startup_guard:
    220             print('Option ``at_startup=True`` for lazy import {0} not needed anymore'.format(self._name))
--> 221         self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name)
    222         name = self._as_name
    223         if self._deprecation is not None:

/usr/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py in <module>()
    103 ## i.e. loading it into ECL
    104 ecl_eval("(setf *load-verbose* NIL)")
--> 105 ecl_eval("(require 'maxima \"{}\")".format(MAXIMA_FAS))
    106 ecl_eval("(in-package :maxima)")
    107 ecl_eval("(setq $nolabels t))")

/usr/lib/python2.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:11019)()
   1324 
   1325 #convenience routine to more easily evaluate strings
-> 1326 cpdef EclObject ecl_eval(str s):
   1327     """
   1328     Read and evaluate string in Lisp and return the result

/usr/lib/python2.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_eval (build/cythonized/sage/libs/ecl.c:10958)()
   1339     cdef cl_object o
   1340     o=ecl_safe_read_string(str_to_bytes(s))
-> 1341     o=ecl_safe_eval(o)
   1342     return ecl_wrap(o)
   1343 

/usr/lib/python2.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_eval (build/cythonized/sage/libs/ecl.c:5930)()
    348     if ecl_nvalues > 1:
    349         s = si_coerce_to_base_string(ecl_values(1))
--> 350         raise RuntimeError("ECL says: {}".format(
    351             char_to_str(ecl_base_string_pointer_safe(s))))
    352     else:

RuntimeError: ECL says: Filesystem error with pathname #P"/usr/lib/ecl/maxima.fas".
Either
 1) the file does not exist, or
 2) we are not allowed to access the file, or
 3) the pathname points to a broken symbolic link.
sage: quit
Exiting Sage (CPU time 0m2.69s, Wall time 7m5.92s).
Exiting FriCAS with PID 23312 running /usr/bin/fricas -nosman

I have fricas Version: FriCAS 1.3.4 installed and working fine.

I installed sagemath now using the system package manager on Linux Manjaro 18.0 Beta 5.

Is the RootOf? was supposed to be fixed in Sagemath 8.4 beta 1? If not, that is OK. But why different error now shows in the above call than before?

Last edited 22 months ago by gh-nasser1 (previous) (diff)

comment:33 Changed 22 months ago by mantepse

I cannot reproduce this, but it looks like being a problem with maxima...

comment:34 Changed 22 months ago by gh-nasser1

I forgot to add maxima info on my Linux: (I am not sure why Maxima is used in the call, when the algorithm is fricas, but this might be because sagemath is using maxima for other things during the call to fricas)

>uname -a
Linux me-pc 4.14.60-1-MANJARO #1 SMP PREEMPT Fri Aug 3 12:49:45 UTC 2018 x86_64 GNU/Linux

>which maxima
/bin/maxima
>maxima -version
;;; Loading #P"/usr/lib/ecl-16.1.2/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/defsystem.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/cmp.fas"
Maxima 5.41.0
>


Btw, this error

RuntimeError: ECL says: Filesystem error with pathname #P"/usr/lib/ecl/maxima.fas".

shows up only when calling fricas from sagemath with that specific integral which used to generate the RootOf? not implemented errror.

If I use another integral, this error do not show up with fricas:

sage: var('x')
x
sage: integrate(sin(x),x,algorithm="fricas")
-cos(x)
sage: 


No error. May be Maxima on my box has problem, I do not know.

comment:35 follow-up: Changed 22 months ago by dimpase

Fricas and Maxima have in Sage ECL, as a common dependency. It seems that here for some reason ECLs used for them are different, but this doesn't quite work.

comment:36 in reply to: ↑ 35 ; follow-up: Changed 22 months ago by mantepse

Replying to dimpase:

Fricas and Maxima have in Sage ECL, as a common dependency. It seems that here for some reason ECLs used for them are different, but this doesn't quite work.

How could this be? Both Fricas and Maxima are built using the same ECL during the build of sage, aren't they?

@nasser: FriCAS' rootOf operator takes a polynomial and means "take any root of this polynomial". Since sage doesn't have an equivalent operator, the code explicitely looks for a root of the given polynomial. This happens to involve maxima...

comment:37 in reply to: ↑ 36 Changed 22 months ago by dimpase

Replying to mantepse:

Replying to dimpase:

Fricas and Maxima have in Sage ECL, as a common dependency. It seems that here for some reason ECLs used for them are different, but this doesn't quite work.

How could this be? Both Fricas and Maxima are built using the same ECL during the build of sage, aren't they?

nasser is testing whatever comes from Arch linux packaging of Sage betas. It could be it's broken ATM.

@nasser: what is the output of sage --maxima? Does it start the system's maxima, as you reported in comment 34?

comment:38 Changed 22 months ago by gh-nasser1

Here is the output:

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.4.beta1, Release Date: 2018-08-14               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: exit
Exiting Sage (CPU time 0m0.08s, Wall time 0m2.89s).


>sage --maxima
;;; Loading #P"/usr/lib/ecl-16.1.2/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/defsystem.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/cmp.fas"
Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.2
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) 


WHich seem to match that when calling maxima directly

>
>maxima
;;; Loading #P"/usr/lib/ecl-16.1.2/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/defsystem.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/cmp.fas"
Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.2
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) 


I installed sagemath using Arch linux package manager. I think the source comes from this page

https://aur.archlinux.org/packages/sagemath-git/

For reference, I also asked about this here a while ago

https://ask.sagemath.org/question/43356/latest-development-version-not-on-aur-arch-linux-repository/

--Nasser

comment:39 Changed 22 months ago by mantepse

To find the implementation used with FriCAS, I think (but I'm not sure) you could do:

sage: fricas.eval(")lisp (lisp-implementation-version)")
sage: fricas.eval(")lisp (lisp-implementation-type)")

comment:40 Changed 22 months ago by gh-nasser1

I installed Fricas also from Arch linux repo, as I mention above, it is version Version: FriCAS 1.3.4.

I run your commands and this is what sage says:

sage: fricas.eval(")lisp (lisp-implementation-version)")
'\nValue = "1.4.8"'
sage:  fricas.eval(")lisp (lisp-implementation-type)")
'\nValue = "SBCL"'
sage: 


May be some could install Manjaro on a Vbox and then installed sagemath from Arch Linux and try to see if they reproduce this new error "RuntimeError?: ECL says: Filesystem error with pathname #P"/usr/lib/ecl/maxima.fas"

It is very easy to install fricas and sagemath using Arch linux. I use the GUI package manager, and add AUR repo to the selection, then search for sagemath and fricas, and select install.

It downloads and compiles everything from git sources and builds everything itself. It takes only 1 hr or so.

Note as I mentioned above, I am using Manjaro 18.0 beta 5 on a VBOx. ISO can be downloaded from Linux Manjaro web site.

Last edited 22 months ago by gh-nasser1 (previous) (diff)

comment:41 follow-up: Changed 22 months ago by dimpase

  • Cc arojas added

I'm cc'ng Arch maintainer - is there something fishy with fricas support withe current Arch package?

comment:42 Changed 22 months ago by mantepse

If you install fricas separately, sagemath will use the global version - which should be good, because sbcl is much faster than ecl.

However, this shouldn't interfere at all with maxima.

One way to debug this is to try to solve the polynomial equation explicitely with maxima. But that's not so easy, because it contains many rootOf operators...

comment:43 in reply to: ↑ 41 Changed 22 months ago by arojas

Replying to dimpase:

I'm cc'ng Arch maintainer - is there something fishy with fricas support withe current Arch package?

The maxima error is caused by #25309, not related to fricas at all (which is not even available in the Arch repos)

Note: See TracTickets for help on using tickets.