Excellent! Thank you very much! This is exactly what I need.

My next step is to define the polynomial ring in the form:
R, (x,z) = PolynomialRing(ZZ, ["x","z"])
=> (Multivariate Polynomial Ring in x, z over Integer Ring, fmpz_mpoly[x, z])

So I only need to know the inderminates, probably via 'listOfTerms'.
Since FriCAS is strongly typed, the coefficient Ring will help for the
different algorithms to be used.
And after I just have to evaluate what I want via the Format1D.
Last step reevaluate in FriCAS the result. That's not computationally
expensive here.

I only plan, for Algebra, to implement expensive computation functions
in different packages.
That will use the FLINT 2 library via Julia if success is with me :)

As a matter of fact :
The arithmetic Fateman bench, here with nested Univariate Polynomials:

FriCAS
===================================================
(34) -> x : UP(x,INT)
(35) -> y : UP(y,UP(x,INT))
(36) -> z : UP(z,UP(y,UP(x,INT)))
(37) -> t : UP(t,UP(z,UP(y,UP(x,INT))))
(38) -> f :=  x + y + z + t + 1
   (38)  t + z + y + x + 1
(39) -> p := f^30;
(40) -> )set message time on
(40) -> q := p*(p+1);
Time: 0 (IN) + 148.97 (EV) + 0.00 (OT) = 148.97 sec
(41) -> q := p*(p+1);
Time: 0.00 (IN) + 151.28 (EV) + 0.00 (OT) = 151.29 sec
===================================================
FLINT 2 via the Nemo library in Julia
===================================================
julia> R, x = PolynomialRing(ZZ, "x");
julia> S, y = PolynomialRing(R, "y");
julia> T, z = PolynomialRing(S, "z");
julia> U, t = PolynomialRing(T, "t");
julia> f = x + y + z + t + 1
t + z + y + x + 1
julia> p = f^30;
julia> @time q = p*(p+1);
 32.041742 seconds (8.72 M allocations: 337.483 MiB, 3.31% gc time,
0.02% compilation time)
julia> @time q = p*(p+1);
 30.781938 seconds (5.67 M allocations: 277.926 MiB, 0.29% gc time)

Le lun. 26 déc. 2022 à 17:43, Ralf Hemmecke <[email protected]> a écrit :
>
> print1D x ==> display((x::OutputForm)::Formatter(Format1D))
> print1D(7*x^3+4*z^9)
>
> Or you can set 1D output format.
>
> setFormat!(Format1D)$JFriCASSupport
> )set output algebra off
>
> See
>
> https://github.com/fricas/fricas/blob/master/src/algebra/fmtjfricas.spad
>
> You can also get a string directly.
>
> first lines formatExpression(7*x^3+4*z^9)$Format1D
>
> Ralf
>
>
> On 26.12.22 16:52, Grégory Vanuxem wrote:
> > Hello,
> >
> > Is there already a way to obtain a linear representation of a
> > polynomial, i.e. 1D and not 2D like
> > 7*x^3+4*z^9
> > instead of
> >               9      3
> >          4 z  + 7 x
> > ideally as a String? And vice versa? Let me specify, in Spad and not
> > via the interpreter.
> >
> > Cheers,
> > __
> > Greg
> >
>
> --
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/fricas-devel/02fab499-32ae-bd38-764f-1196817cdc02%40hemmecke.org.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAHnU2dYWovYEBvCfww-m_kewGZRDQ1GebcTtWJsXj3f5BXrdqw%40mail.gmail.com.

Reply via email to