Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread 'Nasser M. Abbasi' via sage-devel
" yes, simplification (particularly full simplification) can involve some 
algorithms with very high time and space complexities, so seeing memory 
errors is not surprising by itself."

Yes, I know this. But I had to use full_simplify() as simplify() does not 
do the job on some basic expressions. Here is an example using V 10.0

sage: var('x')
x

sage: expr=(1-x)^3+(-x^2+x)^3+(x^2-1)^3-3*(1-x)*(-x^2+x)*(x^2-1)

sage: expr.simplify()
-(x^2 - x)^3 + (x^2 - 1)^3 - 3*(x^2 - x)*(x^2 - 1)*(x - 1) - (x - 1)^3

sage: expr.full_simplify()
0

I think simplify should have been able to do it? in Mathematica Simplify 
can and no need to use its FullSimplify which also uses more resources than 
Simplify. But I understand, simplification is not an easy problem and 
different systems do things differently.

So instead of keeping trying, I was using full_simplify() instead of 
simplify() but this causes problems in some cases.

--Nasser

On Friday, June 23, 2023 at 11:36:30 AM UTC-5 Nils Bruin wrote:

> On Friday, 23 June 2023 at 17:28:03 UTC+1 Dima Pasechnik wrote:
>
> This looks suboptimal and unclear - there are e.g. several occurrences of 
>
> rootOf((625*%%E0^4*a
>   ^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)
>
> Apart from parsing problems inherent in not knowing  which roots are meant 
> exactly, translation of these expressions to sage's internal symbolic 
> system and maximalib (where it ends up judging from the ECL error) is 
> problematic because neiither has a native object to represent RootOf. So 
> these expressions cannot really be handled anyway and simplification is 
> unnlikely to do something useful. Better simplify in fricas.
>
> Considering memory errors from large simplification tasks: yes, 
> simplification (particularly full simplification) can involve some 
> algorithms with very high time and space complexities, so seeing memory 
> errors is not surprising by itself.
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/34196b45-e59b-4ea4-b411-ac4ee4b65001n%40googlegroups.com.


[sage-devel] Re: Modularization project: II. The tools

2023-06-23 Thread Matthias Koeppe
On Monday, June 12, 2023 at 11:13:26 AM UTC-7 Matthias Koeppe wrote:

*The monorepo. *Sage development will continue to use the same one 
repository sagemath/sage  for development 
of the Sage distribution, the Sage library, and the documentation. And the 
structure of the source tree (src/sage) will remain unchanged.

*Integration testing.* The entire Sage library will continue to be tested 
as a whole, both on Sage developers' machines (make ptest, ./sage -t --all) 
and on GitHub Actions.


I'll expand a bit on the role of the monorepo.

The monorepo contains: 
- Configuration and build system of Sage-the-distribution (top-level 
directories *build/ *, 
*m4/* and files *bootstrap*, *configure.ac, Makefile*).
- as part of it, metadata and scripts for packages (directory *build/pkgs/ 
*)
- Monolithic source tree (top-level directory *src/ 
*)
- Python distribution packages (top-level directory *pkgs/ 
*). (Many more 

 
are added in the modularization project.)

Our top-level *bootstrap* script is in charge of synchronizing these parts. 
The metadata in *build/pkgs/* contains version constraints for dependencies 
on Python packages. *bootstrap* fills the version information into 
templates in *pkgs/*/*. After running *bootstrap*, each of the directories 
in *pkgs/* contains the source of a complete Python distribution package, 
which can be built and installed using standard Python tools. There is no 
reference to Sage-the-distribution anywhere in these distribution packages.

Among the Python distribution packages, there is a special distribution 
*pkgs/sage-conf 
*, which 
provides the configuration variable values determined by the top-level 
*configure* script. A separate version of this distribution package, 
*pkgs/sage-conf_pypi 
* is 
published on PyPI; this version runs the *configure* script by itself and 
can build the non-Python bits of the Sage distribution.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/547677bc-6001-47da-a431-6a737a6220fcn%40googlegroups.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread Dima Pasechnik
On Fri, 23 Jun 2023, 22:48 Matthias Koeppe, 
wrote:

> On Friday, June 23, 2023 at 1:24:42 PM UTC-7 Dima Pasechnik wrote:
>
> a lot of this is caused by Sage the distribution intertwined with Sage the
> library too much.
>
>
> It isn't. That was a problem years ago, but it has been fixed with only a
> few odd ends (such as sage.misc.package) remaining.
>

it is a problem. One obvious thing I didn't mention is that releases of
Sage the library and Sage the distribution could be independent of each
other.


>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/07d46292-49e8-4201-bdc2-cd74c6c164c6n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq3weuAUQ3fod63Go%3DrnpM8VgbfhAR3g1DLnJR_WjLyznw%40mail.gmail.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread Matthias Koeppe
On Friday, June 23, 2023 at 1:02:34 PM UTC-7 Michael Orlitzky wrote:

[...] And instead of focusing on 
them we keep getting distracted by squirrels.


Around here, hummingbirds are the bigger problem in this regard

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/0cb1a097-79a7-4133-aaf4-b707f5d13c37n%40googlegroups.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread Matthias Koeppe
On Friday, June 23, 2023 at 1:24:42 PM UTC-7 Dima Pasechnik wrote:

a lot of this is caused by Sage the distribution intertwined with Sage the 
library too much.


It isn't. That was a problem years ago, but it has been fixed with only a 
few odd ends (such as sage.misc.package) remaining.
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/07d46292-49e8-4201-bdc2-cd74c6c164c6n%40googlegroups.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread William Stein
On Fri, Jun 23, 2023 at 1:02 PM Michael Orlitzky 
wrote:

> The second issue is that WebAssembly doesn't actually solve the
> problems we have,


By "the problem we have" I guess maybe you mean "Sage is a lot of work to
maintain".The fundamental
and massive problem that I think SageMath has is that it is not part of
the  Python ecosystem,
by which I mean that there is no good way to do "pip install
sagemath-[foo]", in sufficient generality.

PROBLEM: SageMath is not part of the Python ecosystem.

DEFINITION: A piece of software is part of the Python ecosystem, if you can
do "pip install " on
basically the same platforms as the intersection of where you can install
scipy/numpy/matplotlib/pandas,
and with somewhat comparable resource usage (i.e., installing Sagemath
can't use 100x of the time/space of
the above, as that would be unfair).

There are many tools to help solve this problem, and WebAssembly is
definitely one of those tools, and at least
scipy/numpy/matplotlib/pandas are all well supported via WebAssembly these
days.

If this problem were solved, I think SageMath would likely have much more
usage, which would have
benefits related to other problems such as "Sage is a lot of work to
maintain".

William


-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CACLE5GBmzogG_z9amRgOY5akcZbKnGmdMCYLkAjd1YMjntrefg%40mail.gmail.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread Dima Pasechnik
It's strange that nobody said this already, but a lot of this is caused by
Sage the distribution intertwined with Sage the library too much.
The right way forward is to decouple these two.

I tried to propose something like this years ago, but didn't get far.

In a nutshell, shift the non-Python things, as well as things like vendored
Python, into Sage the distribution project, and use it (or the needed
pieces of it) to build Sage the library.

This way Sage the library can still use more or less the same build system
(but much simplified, e.g. the broken C++ compiler should just trigger an
error, rather than the quest to build gcc/g++), and also Sage the
distribution won't need too much build system modification.
The latter will consume wheels built by Sage the library.
As well, Sage the distribution, ideally, could be replaced by e.g. Conda.

How precisely the partition should look like remains to be worked out, of
course.

Dima





On Fri, 23 Jun 2023, 21:02 Michael Orlitzky,  wrote:

> On Thu, 2023-06-22 at 14:41 -0700, William Stein wrote:
> >
> > WebAssembly is not an experimental linux distribution, and it has very
> > little overlap with linux distributions.  The WebAssembly ecosystem is
> > built from the ground up, primarily on the LLVM (and Rust) toolchain, and
> > an ecosystem of free software that is much more liberally licensed (and
> > smaller) than what is typically in Linux distributions.WebAssembly
> > is neither better nor worse than Linux distributions; instead it is a
> > different thing that solves different problems.
>
> Yes, I know what WebAssembly is. The phrase "pip installability" is a
> essentially euphemism for running a binary linux distribution on pypi
> using pip as the package manager. On top of the many architecture and
> libc-specific binaries that we'll have to build and ship and secure
> forever, you're also suggesting that we maintain LLVM/Rust
> infrastructure that allows us to ship pre-built WebAssembly targets for
> all of those packages as well.
>
> In addition to the usual sage distribution, and now the pypi
> distribution, that would mean also maintaining our own LLVM/Rust-based
> webassembly distribution. It's recreating exactly what Conda, Nix,
> Guix, etc. all do, except with a more experimental toolchain. That's
> the main problem: we don't have time to maintain our one existing
> distribution, and the installation process is already too complicated
> and confusing. With three, it's going to get more complicated, more
> confusing, and more bitrotten as we all start to drown under the
> increased maintenance burden.
>
> The second issue is that WebAssembly doesn't actually solve the
> problems we have, it only pushes them one layer of abstraction up. You
> can run an entire OS in WebAssembly in a browser sandbox in docker in a
> virtual machine. So what? Now you have two computers to maintain. To
> avoid duplicating work, you start to move more and more things into
> that browser. Eventually, you're right back where you started; things
> conflict, etc. Except now everything doesn't work at half the speed
> that it originally didn't work at. There's no way to sweep these
> problems under the rug, they're fundamental. And instead of focusing on
> them we keep getting distracted by squirrels.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/281e65d5ebeb2884b7638a340233db5855d43285.camel%40orlitzky.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq3fjsXJcm7brQtUnNrggqs1EC%2Bd%3DpFgHu-TTBtz5QKf7A%40mail.gmail.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread Michael Orlitzky
On Thu, 2023-06-22 at 14:41 -0700, William Stein wrote:
> 
> WebAssembly is not an experimental linux distribution, and it has very
> little overlap with linux distributions.  The WebAssembly ecosystem is
> built from the ground up, primarily on the LLVM (and Rust) toolchain, and
> an ecosystem of free software that is much more liberally licensed (and
> smaller) than what is typically in Linux distributions.WebAssembly
> is neither better nor worse than Linux distributions; instead it is a
> different thing that solves different problems.

Yes, I know what WebAssembly is. The phrase "pip installability" is a
essentially euphemism for running a binary linux distribution on pypi
using pip as the package manager. On top of the many architecture and
libc-specific binaries that we'll have to build and ship and secure
forever, you're also suggesting that we maintain LLVM/Rust
infrastructure that allows us to ship pre-built WebAssembly targets for
all of those packages as well.

In addition to the usual sage distribution, and now the pypi
distribution, that would mean also maintaining our own LLVM/Rust-based
webassembly distribution. It's recreating exactly what Conda, Nix,
Guix, etc. all do, except with a more experimental toolchain. That's
the main problem: we don't have time to maintain our one existing
distribution, and the installation process is already too complicated
and confusing. With three, it's going to get more complicated, more
confusing, and more bitrotten as we all start to drown under the
increased maintenance burden.

The second issue is that WebAssembly doesn't actually solve the
problems we have, it only pushes them one layer of abstraction up. You
can run an entire OS in WebAssembly in a browser sandbox in docker in a
virtual machine. So what? Now you have two computers to maintain. To
avoid duplicating work, you start to move more and more things into
that browser. Eventually, you're right back where you started; things
conflict, etc. Except now everything doesn't work at half the speed
that it originally didn't work at. There's no way to sweep these
problems under the rug, they're fundamental. And instead of focusing on
them we keep getting distracted by squirrels.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/281e65d5ebeb2884b7638a340233db5855d43285.camel%40orlitzky.com.


Re: [sage-devel] Modularization project: I. The goals

2023-06-23 Thread parisse
I believe that wasm is the future, because you don't have to install 
anything and computations are done in the browser client, they do not 
require ressources from a server (except for the initial download of the 
wasm file). Giac/Xcas does that since many years now, (initially it was a 
request for Geogebra), for example here is the integral from another topic 
in a single URL (you can also embed it in an email from Xcas web interface, 
and it's certainly possible to do the same for other communication channels)
[url=https://www-fourier.univ-grenoble-alpes.fr/%7eparisse/xcasfr.html#exec&filename=%40session&python=1&radian=1&cas=0,0,f%3A%3Dintegrate(x%2F(x%5E5%2Ba%5E5))&cas=0,200,simplify(diff(f))&]session
 
Xcas[/url]
BTW, I presented that to Bill Allombert a few years ago at a PARI meeting 
in Grenoble, and he decided to support wasm target for PARI.

On Thursday, June 22, 2023 at 11:41:43 PM UTC+2 William Stein wrote:

> On Thu, Jun 22, 2023 at 2:15 PM Michael Orlitzky  
> wrote:
>
>> On Thu, 2023-06-22 at 13:56 -0700, William Stein wrote:
>> > 
>> > (5) provide a WebAssembly option
>> > 
>> > WebAssembly is typically about half the speed as native code (at best), 
>> but
>> > it is highly cross platform and self contained.   WebAssembly is 
>> difficult
>> > mainly when you have to deal with the OS somehow (e.g., filesystem,
>> > networking, etc.), and fortunately, a lot of the code in Sage is math
>> > libraries that support a non-threaded mode, so are particularly easy to
>> > port to WebAssembly.  A good example is Pari, which is one of "sage's
>> > non-Python dependencies".
>> > 
>>
>> We always wind up back here. Are we building mathematics software, or
>> signing on to run the world's most experimental linux distribution?
>>
>
>  WebAssembly is not an experimental linux distribution, and it has very 
> little overlap with linux distributions.  The WebAssembly ecosystem is 
> built from the ground up, primarily on the LLVM (and Rust) toolchain, and 
> an ecosystem of free software that is much more liberally licensed (and 
> smaller) than what is typically in Linux distributions.WebAssembly 
> is neither better nor worse than Linux distributions; instead it is a 
> different thing that solves different problems.   
>
> To pre-empt another potential misconception, WebAssembly is more helpful 
> for the needs of Sage than Java VM's because C/C++ can directly target 
> WebAssembly.
>
> William
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/667a39ae-dee3-49f1-931b-7ef9f5435e49n%40googlegroups.com.


Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread Emmanuel Charpentier
FWIW:

```
sage: a, x = var("a, x")
sage: Ex0=x/(a^5+x^5)
sage: FE1=Ex0.integrate(x, algorithm="fricas")
sage: len(repr(FE1))
47199
```

Fricas may be out of joint here... FWIW, I have been unable to typeset this 
expression with neither `pdflate` nor `xelatex`. The only way I had to 
visualize it was to compute it in a Jupyter worksheet, where Mathjax gave 
me a giant expression, explorable only thanks to the side bars (estimated 
size about 4 (kinfg size) bedsheets...).

More on this later.

I note that Sage's default integrator gives a much "smaller" answer : 

```sage: %time SE1=Ex0.integrate(x) # Use Sage's (=Maxima's) default 
integrator
CPU times: user 14.2 ms, sys: 0 ns, total: 14.2 ms
Wall time: 22.1 ms
sage: len(repr(SE1))
607
sage: SE1
-1/5*log(x + (a^5)^(1/5))/(a^5)^(3/5) + 
1/5*sqrt(5)*log(((a^5)^(1/5)*(sqrt(5) + 1) - 4*x + 
(a^5)^(1/5)*sqrt(2*sqrt(5) - 10))/((a^5)^(1/5)*(sqrt(5) + 1) - 4*x - 
(a^5)^(1/5)*sqrt(2*sqrt(5) - 10)))/((a^5)^(3/5)*sqrt(2*sqrt(5) - 10)) - 
1/5*sqrt(5)*log(((a^5)^(1/5)*(sqrt(5) - 1) + 4*x - 
(a^5)^(1/5)*sqrt(-2*sqrt(5) - 10))/((a^5)^(1/5)*(sqrt(5) - 1) + 4*x + 
(a^5)^(1/5)*sqrt(-2*sqrt(5) - 10)))/((a^5)^(3/5)*sqrt(-2*sqrt(5) - 10)) - 
1/5*log(-(a^5)^(1/5)*x*(sqrt(5) + 1) + 2*x^2 + 
2*(a^5)^(2/5))/((a^5)^(3/5)*(sqrt(5) + 1)) + 1/5*log((a^5)^(1/5)*x*(sqrt(5) 
- 1) + 2*x^2 + 2*(a^5)^(2/5))/((a^5)^(3/5)*(sqrt(5) - 1))
```

which *does* differentiate back to the original expression :

```
sage: SE1.diff(x).simplify_full()
x/(a^5 + x^5)
```
 
Fly in the ointment : this expression does not plot : Sage fails to compute 
a real value  for `a=1` and `x` in (-2, 2). This may be attributable to the 
numerous fifth roots occuring in the expression.

Mathematica's results are different :

```
sage: mathematica.Integrate(Ex0, x).sage().simplify_full()
-1/20*((sqrt(5) - 1)*log(-1/2*a*x*(sqrt(5) + 1) + a^2 + x^2) - (sqrt(5) + 
1)*log(1/2*a*x*(sqrt(5) - 1) + a^2 + x^2) + 2*sqrt(-2*sqrt(5) + 
10)*arctan((a*(sqrt(5) - 1) + 4*x)/(a*sqrt(2*sqrt(5) + 10))) + 
2*sqrt(2*sqrt(5) + 10)*arctan((a*(sqrt(5) + 1) - 4*x)/(a*sqrt(-2*sqrt(5) + 
10))) + 4*log(a + x))/a^3
```

This expression, with `a=1`, *does* plot as real for x>-1 to x=2.
Le vendredi 23 juin 2023 à 18:14:50 UTC+2, Nasser M. Abbasi a écrit :

> This is output from Fricas itself directly
>
> (2) -> setSimplifyDenomsFlag(true) 
>
>(2)  false
> Type: 
> Boolean
> (3) -> ii:=integrate(x/(a^5+x^5),x);
>
>  Type: 
> Union(Expression(Integer),...)
> (4) -> unparse(ii::InputForm) 
>
>(4)
>   
> "(((-5)*a^3*(((-75)*a^6*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3
>   
> *a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^
>   
> 6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(
>   
> 625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^
>   
> 12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E
>   
> 1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)^2+((-50)*a^6*rootO
>   
> f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
>   
> ),%%E0)+10*a^3)*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
>   
> %%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootO
>   
> f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
>   
> ),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125
>   
> )*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+
>   
> (-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)+((-75)*a^6*rootOf((625*%%E
>   
> 0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+
>   
> 10*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+
>   
> 1)/(625*a^12),%%E0)+(-3)))/(25*a^6))^(1/2)+((-5)*a^3*rootOf((125*a^9*rootOf((
>   
> 625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%
>   
> %E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
>   
> %%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6
>   
> +5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3
>   
> +1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*
>   
> a^9),%%E1)+((-5)*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+
>   
> (-5)*%%E0*a^3+1)/(625*a^12),%%E0)+1)))*log(((125*a^10*rootOf((625*%%E0^4*a^12
>   
> +(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-25)*a^7)
>   
> *rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)
>   
> *%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a
>   
> ^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*
>   
> %%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25
>   
> *%%E0

Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread Nils Bruin
On Friday, 23 June 2023 at 17:28:03 UTC+1 Dima Pasechnik wrote:

This looks suboptimal and unclear - there are e.g. several occurrences of 

rootOf((625*%%E0^4*a
  ^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)

Apart from parsing problems inherent in not knowing  which roots are meant 
exactly, translation of these expressions to sage's internal symbolic 
system and maximalib (where it ends up judging from the ECL error) is 
problematic because neiither has a native object to represent RootOf. So 
these expressions cannot really be handled anyway and simplification is 
unnlikely to do something useful. Better simplify in fricas.

Considering memory errors from large simplification tasks: yes, 
simplification (particularly full simplification) can involve some 
algorithms with very high time and space complexities, so seeing memory 
errors is not surprising by itself.
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/f19fce16-f349-4d80-ba0e-d73251c1cbd8n%40googlegroups.com.


Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread Dima Pasechnik
This looks suboptimal and unclear - there are e.g. several occurrences of

rootOf((625*%%E0^4*a
  ^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)


Do these occurrences correspond to just one fixed root?
(and so one can write it as the sum over all the roots, divided by the
number of roots)





On Fri, 23 Jun 2023, 17:14 'Nasser M. Abbasi' via sage-devel, <
sage-devel@googlegroups.com> wrote:

> This is output from Fricas itself directly
>
> (2) -> setSimplifyDenomsFlag(true)
>
>(2)  false
> Type:
> Boolean
> (3) -> ii:=integrate(x/(a^5+x^5),x);
>
>  Type:
> Union(Expression(Integer),...)
> (4) -> unparse(ii::InputForm)
>
>(4)
>
> "(((-5)*a^3*(((-75)*a^6*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3
>
> *a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^
>
> 6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(
>
> 625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^
>
> 12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E
>
> 1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)^2+((-50)*a^6*rootO
>
> f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
>
> ),%%E0)+10*a^3)*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
>
> %%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootO
>
> f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
>
> ),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125
>
> )*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+
>
> (-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)+((-75)*a^6*rootOf((625*%%E
>
> 0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+
>
> 10*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+
>
> 1)/(625*a^12),%%E0)+(-3)))/(25*a^6))^(1/2)+((-5)*a^3*rootOf((125*a^9*rootOf((
>
> 625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%
>
> %E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
>
> %%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6
>
> +5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3
>
> +1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*
>
> a^9),%%E1)+((-5)*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+
>
> (-5)*%%E0*a^3+1)/(625*a^12),%%E0)+1)))*log(((125*a^10*rootOf((625*%%E0^4*a^12
>
> +(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-25)*a^7)
>
> *rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)
>
> *%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a
>
> ^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*
>
> %%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25
>
> *%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^
>
> 6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)+(-25)*a^7*rootOf((625*%%E0^4*a^12+(-125)*
>
> %%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0))*(((-75)*a^6*rootO
>
> f((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*
>
> a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-
>
> 125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2
>
> *a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^
>
> 2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%
>
> E1*a^3+(-1)))/(125*a^9),%%E1)^2+((-50)*a^6*rootOf((625*%%E0^4*a^12+(-125)*%%E
>
> 0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+10*a^3)*rootOf((125*a
>
> ^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(
>
> 625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E
>
> 0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-2
>
> 5)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-
>
> 5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(
>
> -1)))/(125*a^9),%%E1)+((-75)*a^6*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25
>
> *%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+10*a^3*rootOf((625*%%E0^4*a^1
>
> 2+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-3)))/(2
>
> 5*a^6))^(1/2)+(((-125)*a^10*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0
>
> ^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+25*a^7)*rootOf((125*a^9*rootOf((625*
>
> %%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)
>
> ^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0
>
> ^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a
>
> ^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a

Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread 'Nasser M. Abbasi' via sage-devel
This is output from Fricas itself directly

(2) -> setSimplifyDenomsFlag(true) 

   (2)  false
Type: 
Boolean
(3) -> ii:=integrate(x/(a^5+x^5),x);

 Type: 
Union(Expression(Integer),...)
(4) -> unparse(ii::InputForm) 

   (4)
  
"(((-5)*a^3*(((-75)*a^6*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3
  
*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^
  
6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(
  
625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^
  
12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E
  
1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)^2+((-50)*a^6*rootO
  
f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
  
),%%E0)+10*a^3)*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
  
%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootO
  
f((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12
  
),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125
  
)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+
  
(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)+((-75)*a^6*rootOf((625*%%E
  
0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+
  
10*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+
  
1)/(625*a^12),%%E0)+(-3)))/(25*a^6))^(1/2)+((-5)*a^3*rootOf((125*a^9*rootOf((
  
625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%
  
%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*
  
%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6
  
+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3
  
+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*
  
a^9),%%E1)+((-5)*a^3*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+
  
(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+1)))*log(((125*a^10*rootOf((625*%%E0^4*a^12
  
+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-25)*a^7)
  
*rootOf((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)
  
*%%E0*a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a
  
^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*
  
%%E1^2*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25
  
*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^
  
6+5*%%E1*a^3+(-1)))/(125*a^9),%%E1)+(-25)*a^7*rootOf((625*%%E0^4*a^12+(-125)*
  
%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0))*(((-75)*a^6*rootO
  
f((125*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*
  
a^3+1)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-
  
125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2
  
*a^9+(-25)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^
  
2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%
  
E1*a^3+(-1)))/(125*a^9),%%E1)^2+((-50)*a^6*rootOf((625*%%E0^4*a^12+(-125)*%%E
  
0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+10*a^3)*rootOf((125*a
  
^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(
  
625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E
  
0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-2
  
5)*%%E1*a^6+5*a^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-
  
5)*%%E0*a^3+1)/(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(
  
-1)))/(125*a^9),%%E1)+((-75)*a^6*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25
  
*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+10*a^3*rootOf((625*%%E0^4*a^1
  
2+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-3)))/(2
  
5*a^6))^(1/2)+(((-125)*a^10*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0
  
^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+25*a^7)*rootOf((125*a^9*rootOf((625*
  
%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)
  
^3+(125*%%E1*a^9+(-25)*a^6)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0
  
^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+(125*%%E1^2*a^9+(-25)*%%E1*a^6+5*a
  
^3)*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/
  
(625*a^12),%%E0)+(125*%%E1^3*a^9+(-25)*%%E1^2*a^6+5*%%E1*a^3+(-1)))/(125*a^9)
  
,%%E1)^2+((-125)*a^10*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6
  
+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)^2+25*a^7*rootOf((625*%%E0^4*a^12+(-125)*%%
  
E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1)/(625*a^12),%%E0)+(-5)*a^4)*rootOf((12
  
5*a^9*rootOf((625*%%E0^4*a^12+(-125)*%%E0^3*a^9+25*%%E0^2*a^6+(-5)*%%E0*a^3+1
  
)/(625*a^12),%%E0)^3+(125*%%E1*a^9+(-25)*a^6)*roo

Re: [sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread Dima Pasechnik
What is the output provided by fricas (outside Sage) ?
(perhaps it's a short expression as a root sum?)


Simplifying an expression given as  a string of length 47K is not an easy
task.



On Fri, 23 Jun 2023, 08:21 'Nasser M. Abbasi' via sage-devel, <
sage-devel@googlegroups.com> wrote:

> Here is the code to reproduce it. Using Fricas 1.3.8 on Linux via sagemath
>
> var('x a')
> expr=integrate(x/(a^5+x^5),x, algorithm="fricas");
> len(str(expr))
>  47199
> expr.full_simplify()
>
> TypeError: ECL says: Memory limit reached. Please jump to an outer
> pointer, quit program and enlarge the
> memory limits before executing the program again.
>
> --Nasser
>
>
> On Friday, June 23, 2023 at 2:15:18 AM UTC-5 Nasser M. Abbasi wrote:
>
>> I obtained a large expression from CAS system (Fricas) calling it from
>> sagemath.
>>
>> When I did expr.full_simplify() sagemath 10.0 on Linux gave this error
>>
>> TypeError: ECL says: Memory limit reached. Please jump to an outer
>> pointer, quit program and enlarge the
>> memory limits before executing the program again.
>>
>> Is this to be expected for very large expression?
>>
>> Here is full error
>>
>> age: expr.full_simplify()
>>
>> ---
>> RuntimeError  Traceback (most recent call
>> last)
>> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:748, in
>> InterfaceElement.__init__(self, parent, value, is_name, name)
>> 747 try:
>> --> 748 self._name = parent._create(value, name=name)
>> 749 except (TypeError, RuntimeError, ValueError) as x:
>>
>> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:618, in
>> MaximaLib._create(self, value, name)
>> 617 else:
>> --> 618 self.set(name, value)
>> 619 except RuntimeError as error:
>>
>> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:526, in
>> MaximaLib.set(self, var, value)
>> 525 cmd = '%s : %s$'%(var, value.rstrip(';'))
>> --> 526 self.eval(cmd)
>>
>> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:472, in
>> MaximaLib._eval_line(self, line, locals, reformat, **kwds)
>> 471 if statement:
>> --> 472 maxima_eval("#$%s$" % statement)
>> 473 if not reformat:
>>
>> File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:830, in
>> sage.libs.ecl.EclObject.__call__()
>> 829 lispargs = EclObject(list(args))
>> --> 830 return
>> ecl_wrap(ecl_safe_apply(self.obj,(lispargs).obj))
>> 831
>>
>> File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:353, in
>> sage.libs.ecl.ecl_safe_apply()
>> 352 else:
>> --> 353 raise RuntimeError("ECL says: {}".format(message))
>> 354 else:
>>
>> RuntimeError: ECL says: Memory limit reached. Please jump to an outer
>> pointer, quit program and enlarge the
>> memory limits before executing the program again.
>>
>> During handling of the above exception, another exception occurred:
>>
>> TypeError Traceback (most recent call
>> last)
>> Cell In [7], line 1
>> > 1 expr.full_simplify()
>>
>> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10749, in
>> sage.symbolic.expression.Expression.simplify_full()
>>   10747 x = self
>>   10748 x = x.simplify_factorial()
>> > 10749 x = x.simplify_rectform()
>>   10750 x = x.simplify_trig()
>>   10751 x = x.simplify_rational()
>>
>> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10899, in
>> sage.symbolic.expression.Expression.simplify_rectform()
>>   10897
>>   10898 """
>> > 10899 simplified_expr = self.rectform()
>>   10900
>>   10901 if complexity_measure is None:
>>
>> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10549, in
>> sage.symbolic.expression.Expression.rectform()
>>   10547 0.0
>>   10548 """
>> > 10549 return self.maxima_methods().rectform()
>>   10550
>>   10551 def unhold(self, exclude=None):
>>
>> File ~/TMP/sage-10.0/src/sage/symbolic/maxima_wrapper.py:31, in
>> MaximaFunctionElementWrapper.__call__(self, *args, **kwds)
>>  18 def __call__(self, *args, **kwds):
>>  19 """
>>  20 Return a Sage expression instead of a Maxima pexpect
>> interface element.
>>  21
>>(...)
>>  29 Symbolic Ring
>>  30 """
>> ---> 31 return super().__call__(*args, **kwds).sage()
>>
>> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:696, in
>> InterfaceFunctionElement.__call__(self, *args, **kwds)
>> 695 def __call__(self, *args, **kwds):
>> --> 696 return self._obj.parent().function_call(self._name,
>> [self._obj] + list(args), kwds)
>>
>> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:616, in
>> Interface.function_call(self, function, args, kwds)
>> 612 self._check_valid_function_name(function)
>> 613 s = self._function_call_string(function,
>> 614[s.name() for s in args],
>> 615['%s=%s'%(key,value.name()) for
>> key, value in kwds.items()

[sage-devel] Re: ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread 'Nasser M. Abbasi' via sage-devel
Here is the code to reproduce it. Using Fricas 1.3.8 on Linux via sagemath

var('x a')
expr=integrate(x/(a^5+x^5),x, algorithm="fricas");
len(str(expr))
 47199
expr.full_simplify()

TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, 
quit program and enlarge the
memory limits before executing the program again.

--Nasser


On Friday, June 23, 2023 at 2:15:18 AM UTC-5 Nasser M. Abbasi wrote:

> I obtained a large expression from CAS system (Fricas) calling it from 
> sagemath.
>
> When I did expr.full_simplify() sagemath 10.0 on Linux gave this error
>
> TypeError: ECL says: Memory limit reached. Please jump to an outer 
> pointer, quit program and enlarge the
> memory limits before executing the program again.
>
> Is this to be expected for very large expression? 
>
> Here is full error
>
> age: expr.full_simplify()
> ---
> RuntimeError  Traceback (most recent call last)
> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:748, in 
> InterfaceElement.__init__(self, parent, value, is_name, name)
> 747 try:
> --> 748 self._name = parent._create(value, name=name)
> 749 except (TypeError, RuntimeError, ValueError) as x:
>
> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:618, in 
> MaximaLib._create(self, value, name)
> 617 else:
> --> 618 self.set(name, value)
> 619 except RuntimeError as error:
>
> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:526, in 
> MaximaLib.set(self, var, value)
> 525 cmd = '%s : %s$'%(var, value.rstrip(';'))
> --> 526 self.eval(cmd)
>
> File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:472, in 
> MaximaLib._eval_line(self, line, locals, reformat, **kwds)
> 471 if statement:
> --> 472 maxima_eval("#$%s$" % statement)
> 473 if not reformat:
>
> File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:830, in 
> sage.libs.ecl.EclObject.__call__()
> 829 lispargs = EclObject(list(args))
> --> 830 return ecl_wrap(ecl_safe_apply(self.obj,(lispargs).obj))
> 831 
>
> File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:353, in 
> sage.libs.ecl.ecl_safe_apply()
> 352 else:
> --> 353 raise RuntimeError("ECL says: {}".format(message))
> 354 else:
>
> RuntimeError: ECL says: Memory limit reached. Please jump to an outer 
> pointer, quit program and enlarge the
> memory limits before executing the program again.
>
> During handling of the above exception, another exception occurred:
>
> TypeError Traceback (most recent call last)
> Cell In [7], line 1
> > 1 expr.full_simplify()
>
> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10749, in 
> sage.symbolic.expression.Expression.simplify_full()
>   10747 x = self
>   10748 x = x.simplify_factorial()
> > 10749 x = x.simplify_rectform()
>   10750 x = x.simplify_trig()
>   10751 x = x.simplify_rational()
>
> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10899, in 
> sage.symbolic.expression.Expression.simplify_rectform()
>   10897 
>   10898 """
> > 10899 simplified_expr = self.rectform()
>   10900 
>   10901 if complexity_measure is None:
>
> File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10549, in 
> sage.symbolic.expression.Expression.rectform()
>   10547 0.0
>   10548 """
> > 10549 return self.maxima_methods().rectform()
>   10550 
>   10551 def unhold(self, exclude=None):
>
> File ~/TMP/sage-10.0/src/sage/symbolic/maxima_wrapper.py:31, in 
> MaximaFunctionElementWrapper.__call__(self, *args, **kwds)
>  18 def __call__(self, *args, **kwds):
>  19 """
>  20 Return a Sage expression instead of a Maxima pexpect interface 
> element.
>  21 
>(...)
>  29 Symbolic Ring
>  30 """
> ---> 31 return super().__call__(*args, **kwds).sage()
>
> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:696, in 
> InterfaceFunctionElement.__call__(self, *args, **kwds)
> 695 def __call__(self, *args, **kwds):
> --> 696 return self._obj.parent().function_call(self._name, 
> [self._obj] + list(args), kwds)
>
> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:616, in 
> Interface.function_call(self, function, args, kwds)
> 612 self._check_valid_function_name(function)
> 613 s = self._function_call_string(function,
> 614[s.name() for s in args],
> 615['%s=%s'%(key,value.name()) for 
> key, value in kwds.items()])
> --> 616 return self.new(s)
>
> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:385, in 
> Interface.new(self, code)
> 384 def new(self, code):
> --> 385 return self(code)
>
> File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:298, in 
> Interface.__call__(self, x, name)
> 295 pass
> 297 if isinstance(x, str):
> --> 298 return cls(self, x, name=name)
> 299 try:
> 

[sage-devel] ECL says: Memory limit reached calling expr.full_simplify()

2023-06-23 Thread 'Nasser M. Abbasi' via sage-devel
I obtained a large expression from CAS system (Fricas) calling it from 
sagemath.

When I did expr.full_simplify() sagemath 10.0 on Linux gave this error

TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, 
quit program and enlarge the
memory limits before executing the program again.

Is this to be expected for very large expression? 

Here is full error

age: expr.full_simplify()
---
RuntimeError  Traceback (most recent call last)
File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:748, in 
InterfaceElement.__init__(self, parent, value, is_name, name)
747 try:
--> 748 self._name = parent._create(value, name=name)
749 except (TypeError, RuntimeError, ValueError) as x:

File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:618, in 
MaximaLib._create(self, value, name)
617 else:
--> 618 self.set(name, value)
619 except RuntimeError as error:

File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:526, in 
MaximaLib.set(self, var, value)
525 cmd = '%s : %s$'%(var, value.rstrip(';'))
--> 526 self.eval(cmd)

File ~/TMP/sage-10.0/src/sage/interfaces/maxima_lib.py:472, in 
MaximaLib._eval_line(self, line, locals, reformat, **kwds)
471 if statement:
--> 472 maxima_eval("#$%s$" % statement)
473 if not reformat:

File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:830, in 
sage.libs.ecl.EclObject.__call__()
829 lispargs = EclObject(list(args))
--> 830 return ecl_wrap(ecl_safe_apply(self.obj,(lispargs).obj))
831 

File ~/TMP/sage-10.0/src/sage/libs/ecl.pyx:353, in 
sage.libs.ecl.ecl_safe_apply()
352 else:
--> 353 raise RuntimeError("ECL says: {}".format(message))
354 else:

RuntimeError: ECL says: Memory limit reached. Please jump to an outer 
pointer, quit program and enlarge the
memory limits before executing the program again.

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
Cell In [7], line 1
> 1 expr.full_simplify()

File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10749, in 
sage.symbolic.expression.Expression.simplify_full()
  10747 x = self
  10748 x = x.simplify_factorial()
> 10749 x = x.simplify_rectform()
  10750 x = x.simplify_trig()
  10751 x = x.simplify_rational()

File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10899, in 
sage.symbolic.expression.Expression.simplify_rectform()
  10897 
  10898 """
> 10899 simplified_expr = self.rectform()
  10900 
  10901 if complexity_measure is None:

File ~/TMP/sage-10.0/src/sage/symbolic/expression.pyx:10549, in 
sage.symbolic.expression.Expression.rectform()
  10547 0.0
  10548 """
> 10549 return self.maxima_methods().rectform()
  10550 
  10551 def unhold(self, exclude=None):

File ~/TMP/sage-10.0/src/sage/symbolic/maxima_wrapper.py:31, in 
MaximaFunctionElementWrapper.__call__(self, *args, **kwds)
 18 def __call__(self, *args, **kwds):
 19 """
 20 Return a Sage expression instead of a Maxima pexpect interface 
element.
 21 
   (...)
 29 Symbolic Ring
 30 """
---> 31 return super().__call__(*args, **kwds).sage()

File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:696, in 
InterfaceFunctionElement.__call__(self, *args, **kwds)
695 def __call__(self, *args, **kwds):
--> 696 return self._obj.parent().function_call(self._name, [self._obj] 
+ list(args), kwds)

File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:616, in 
Interface.function_call(self, function, args, kwds)
612 self._check_valid_function_name(function)
613 s = self._function_call_string(function,
614[s.name() for s in args],
615['%s=%s'%(key,value.name()) for key, 
value in kwds.items()])
--> 616 return self.new(s)

File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:385, in 
Interface.new(self, code)
384 def new(self, code):
--> 385 return self(code)

File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:298, in 
Interface.__call__(self, x, name)
295 pass
297 if isinstance(x, str):
--> 298 return cls(self, x, name=name)
299 try:
300 # Special methods do not and should not have an option to
301 # set the name directly, as the identifier assigned by the
302 # interface should stay consistent. An identifier with a
303 # user-assigned name might change its value, so we return a
304 # new element.
305 result = self._coerce_from_special_method(x)

File ~/TMP/sage-10.0/src/sage/interfaces/interface.py:750, in 
InterfaceElement.__init__(self, parent, value, is_name, name)
748 self._name = parent._create(value, name=name)
749 except (TypeError, RuntimeError, ValueError) as x:
--> 750 raise TypeError(x)

TypeError: ECL