Now I understand most of your points.

So what are the possible improvements regarding algebraic number
in the future?

For example, in a "locally breaking symmetry" use case, a "real?"
function to determine if an algebraic number is real, is that useful?
(e.g. (sqrt(3+4*sqrt(-1))+sqrt(3-4*sqrt(-1))))

Also, there's no function to transform a radical ('nthRoot) to
'rootOf currently, right?

- Qian

On 11/21/23 23:39, Waldek Hebisch wrote:
On Tue, Nov 21, 2023 at 08:38:49PM +0800, Qian Yun wrote:


On 11/21/23 20:26, Waldek Hebisch wrote:
On Tue, Nov 21, 2023 at 06:35:57PM +0800, Qian Yun wrote:

If so, I want to confirm that is 'nthRoot already a kind of
algebraic number?

I am not sure what you want to say here: 'nthRoot is in
AlgebraicNumber which under right conditions models
algebraic numbers and in Expression, where we have
things more general than numbers.


OK, to give a specific example, what's the relationship
between sqrt(2) (a 'nthRoot) and %x0 (a 'rootOf):

(1) -> sqrt(2)

          +-+
    (1)  \|2

(2) -> rootsOf(x^2-2)

    (2)  [%x0, - %x0]

Using them together is user error.  Argument to rootOf is supposed
to be irreducible polynomial.  Once you add 'sqrt(2)' polynomial
'x^2 - 2' factors, so considering both togehter is user error.

Both could be used to represent "the same" element of AlgebraicNumber.
To put it differently, you should be able to replace one by the
other in all places and get correct result.  Due to the way
in which AlgebraicNumber works, if you get one as input you
should return the same in the output.  OTOH, internally one
can be replaced by the other if computation is more convenient
with different representation.  Of course, after computation
is done we need to do backsubstitution, so that kernels
are preserved in the output.

Ralf's code allows you to have both in single computation
and either you have sqrt(2) = rootsOf(x^2-2) or
sqrt(2) = -rootsOf(x^2-2).  Which of the two equalites holds
is depends on implementation in a way which for practical
purposes should be considered random.

Note that '>' (order) is not defined for AlgebraicNumber,
so it makes no sense to ask if "sqrt(2) > 0".

To put it differently, Galois theory says that at algebraic
level role of 'sqrt(2)' and '-sqrt(2)' is entirely symmetric.
You (and lot ot other folks) want to break this symmetry.
IMO breaking symmetry for AlgebraicNumber and for Expression
as domains is undesirable.  Simply, it requires a lot of effort
and breaking symmetry is dangerous as it may break algorithms
that depend on symmetry.  OTOH, locally we may do some things
that break symmetry, but we need to be careful since rest of
algbera will _not_ cooperate and each place when we break
symmetry need some justitication that it will not introduce
contradictions.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/045834c6-36f5-4873-8b45-701ba6f0f1ec%40gmail.com.

Reply via email to