|
|
last edited 8 years ago by test1 |
1 2 3 | ||
Editor: test1
Time: 2016/11/14 20:46:40 GMT+0 |
||
Note: |
added:
From test1 Mon Nov 14 20:46:40 +0000 2016
From: test1
Date: Mon, 14 Nov 2016 20:46:40 +0000
Subject:
Message-ID: <20161114204640+0000@axiom-wiki.newsynthesis.org>
Status: open => closed
FriCAS now modified equality so the problem is not present.
I try :
(1) -> a := 3 + sqrt 5
(1) |
(-a = (a^2)^(1/2))::Boolean
(2) |
But
(sqrt 2 = - sqrt 2)::Boolean
(3) |
I expect the same result, and I prefer false.
true
.
Axiom's sqrt does not seem to be multiple valued, so therefore I
disagree with you Bill, it cannot be the general solution of the
polynomial. As with most other systems, sqrt is taken to be the
positive root only, and if it comes from the solution of a quadratic,
the +/- multiple valued-ness must be encoded elsewhere.
e.g.
sqrt(2)::Float
(4) |
gives only one value.
Also note that axiom is not even self-consistent here:
-a::Float
(5) |
(a^2)^(1/2)::Float
(6) |
which clearly are not equal.
If you write:-a=(a^2)^(1/2)
(7) |
coerce(%%(7))$Equation(AlgebraicNumber)
(8) |
you are asking about equality in the domain of AlgebraicNumber? (whatever that happens to be). But if you write:
coerce(%%(7)::Equation(Float))$Equation(Float)
(9) |
then you are referring to equality in the domain
Float. These need not be the same thing. But I agree
that Axiom does not have an entirely consistent
treatment of sqrt
even within a given domain. :(
http://wiki.axiom-developer.org/axiom--test--1/src/algebra/ConstantSpad
In AlgebraicNumber? we find:
a=b == trueEqual((a-b)::Rep,0::Rep)
In InnerAlgebraicNumber? it says:
trueEqual(a,b) == -- if two algebraic numbers have the same norm (after deleting repeated -- roots, then they are certainly conjugates. Note that we start with a -- monic polynomial, so don't have to check for constant factors. -- this will be fooled by sqrt(2) and -sqrt(2), but the = in -- AlgebraicNumber knows what to do about this.
but unfortunately is seems that the special treatment of sqrt(2)
(and similar algebraic numbers) was never implemented. :(
Apparently IAN implements trueEqual
as the equivalence relation
defined by conjugation:
trueEqual : (%,%) -> Boolean ++ trueEqual(x,y) tries to determine if the two numbers are equal
trueEqual(sqrt(2),This is quite strange. As I understand it,-sqrt(2))$IAN
IAN is not a valid type.
AN
is almost IAN
(only three functions have over-riding implementations: zero?
, one?
, and =
) and yet, =
in AN
is not transitive, but apparently, trueEqual
in IAN
is:
a:AN:=sqrt(5)+3
(10) |
b:=(a^2)^(1/2)
(11) |
(a=b)::Boolean
(12) |
(a=-b)::Boolean
(13) |
(b=-b)::Boolean
(14) |
f:IAN:=sqrt(5)+3
IAN is not a valid type.
But this is deceptive since trueEqual(g, -g)
is not trueEqual(g+g,0)
. Note we cannot use trueEqual(a,b)
or trueEqual(a-b,0)
since there is no coercion from AN
to IAN
. Moreover, trueEqual
is not transitive either.
trueEqual(g+g,0)
There is also =
in IAN
, which is implemented using =
in EXPR INT
.
Perhaps trueEqual
should be called conjugate?
instead and exported from AN
, and =
in AN
is really not possible. Also, trueEqual
is only used in constant.spad
and changing its name will not affect any other constructors. But
Two elements alpha, beta of a field K, which is an extension field of a field F, are called conjugate (over F) if they are both algebraic over F and have the same minimal polynomial. ... This conjugacy relation is an equivalence relation on the set of algebraic elements in a given extension K of the field F.
So if trueEqual
is supposed to implement conjugate?
then
the bug must be in trueEqual
, I think.
Some details of the algorithm are here:
http://www.csd.uwo.ca/~watt/pub/reprints/1995-issac-dynev.pdf
See especially reference [DDD].
Anonymous wrote:I expect the same result, and I prefer false.
This result is possible using the RealClosure package:
Ran := RealClosure( Fraction(Integer) )
(15) |
a1:Ran := 3 + sqrt 5
(16) |
(-a1 = (a1^2)^(1/2))::Boolean
(17) |
a2:=sqrt(2)$Ran
(18) |
a3:=-sqrt(2)$Ran
(19) |
(a2=a3)::Boolean
(20) |