Discussion:
[fricas-devel] [FricasUG] Descriptions of rootOf(suv,x) and rootsOf(suv,x) seem, unhonored
Riccardo GUIDA
2018-07-26 14:49:37 UTC
Permalink
Mainly Ralf ...

From
https://github.com/fricas/fricas/blob/master/src/algebra/algfunc.spad#L14

rootOf : (SparseUnivariatePolynomial %, Symbol) -> %
++ rootOf(p, y) returns y such that \spad{p(y) = 0}.
++ The object returned displays as \spad{'y}.



https://github.com/fricas/fricas/blob/master/src/algebra/algfunc.spad#L26

rootsOf : (SparseUnivariatePolynomial %, Symbol) -> List %
++ rootsOf(p, z) returns \spad{[y1, ..., yn]} such that \spad{p(yi) = 0};
++ The returned roots contain new symbols \spad{'%z0}, \spad{'%z1} ...;
++ Note: the new symbols are bound in the interpreter to the
++ respective values.


From the wordings above I would have expected see %z0, %z1,...
in (4), (5) below...

Don't you?


(1) -> suv:(SparseUnivariatePolynomial(Integer)) := x^10-1

10
(1) ? - 1
Type: SparseUnivariatePolynomial(Integer)
(2) -> rootOf(suv) -- OK

(2) %A
Type: AlgebraicNumber
(3) -> rootsOf(suv) -- OK

(3)
2 3 3 2
[%A, %%B1 %A, %%B1 %A, %%B1 %A, (%%B1 - %%B1 + %%B1 - 1)%A, - %A,
2 3 3 2
- %%B1 %A, - %%B1 %A, - %%B1 %A, (- %%B1 + %%B1 - %%B1 + 1)%A]
Type: List(AlgebraicNumber)
(4) -> rootOf(suv,z) -- expected %z ...

(4) %A
Type: AlgebraicNumber
(5) -> rootsOf(suv,z) -- expected %z ...

(5)
2 3 3 2
[%A, %%B1 %A, %%B1 %A, %%B1 %A, (%%B1 - %%B1 + %%B1 - 1)%A, - %A,
2 3 3 2
- %%B1 %A, - %%B1 %A, - %%B1 %A, (- %%B1 + %%B1 - %%B1 + 1)%A]
Type: List(AlgebraicNumber)
--
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 fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Waldek Hebisch
2018-07-27 15:45:49 UTC
Permalink
Post by Riccardo GUIDA
Mainly Ralf ...
From
https://github.com/fricas/fricas/blob/master/src/algebra/algfunc.spad#L14
rootOf : (SparseUnivariatePolynomial %, Symbol) -> %
++ rootOf(p, y) returns y such that \spad{p(y) = 0}.
++ The object returned displays as \spad{'y}.
https://github.com/fricas/fricas/blob/master/src/algebra/algfunc.spad#L26
rootsOf : (SparseUnivariatePolynomial %, Symbol) -> List %
++ rootsOf(p, z) returns \spad{[y1, ..., yn]} such that \spad{p(yi) = 0};
++ The returned roots contain new symbols \spad{'%z0}, \spad{'%z1} ...;
++ Note: the new symbols are bound in the interpreter to the
++ respective values.
From the wordings above I would have expected see %z0, %z1,...
in (4), (5) below...
Don't you?
(1) -> suv:(SparseUnivariatePolynomial(Integer)) := x^10-1
10
(1) ? - 1
Type: SparseUnivariatePolynomial(Integer)
(2) -> rootOf(suv) -- OK
(2) %A
Type: AlgebraicNumber
(3) -> rootsOf(suv) -- OK
(3)
2 3 3 2
[%A, %%B1 %A, %%B1 %A, %%B1 %A, (%%B1 - %%B1 + %%B1 - 1)%A, - %A,
2 3 3 2
- %%B1 %A, - %%B1 %A, - %%B1 %A, (- %%B1 + %%B1 - %%B1 + 1)%A]
Type: List(AlgebraicNumber)
(4) -> rootOf(suv,z) -- expected %z ...
(4) %A
Type: AlgebraicNumber
(5) -> rootsOf(suv,z) -- expected %z ...
(5)
2 3 3 2
[%A, %%B1 %A, %%B1 %A, %%B1 %A, (%%B1 - %%B1 + %%B1 - 1)%A, - %A,
2 3 3 2
- %%B1 %A, - %%B1 %A, - %%B1 %A, (- %%B1 + %%B1 - %%B1 + 1)%A]
Type: List(AlgebraicNumber)
This is the same thing that recently confused Martin: FriCAS makes
some effort to have only one kernel with given value. If you
try to create "the same" kernel twice you get kernel that you
created the first time. For most kernels this cause no visible
effect. But some kernels contain information that is only used
for printing but irrelevant for mathematical equality. Roots
(above) are one example. Unevaluated sums and integrals are
another example.

In fresh session you get:

(5) -> suv:(SparseUnivariatePolynomial(Integer)) := x^10-1

10
(5) ? - 1
Type: SparseUnivariatePolynomial(Integer)
(6) -> rootsOf(suv,z)

(6)
2 3 3 2
[%z0, %z0 %z1, %z0 %z1 , %z0 %z1 , %z0 %z1 - %z0 %z1 + %z0 %z1 - %z0,
2 3
- %z0, - %z0 %z1, - %z0 %z1 , - %z0 %z1 ,
3 2
- %z0 %z1 + %z0 %z1 - %z0 %z1 + %z0]
Type: List(AlgebraicNumber)

as expected. But after creatation root will not change.
--
Waldek Hebisch
--
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 fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Loading...