login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Submitted by : (unknown) at: 2007-11-17T22:21:16-08:00 (17 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

FriCAS now modified equality so the problem is not present.

I try :

fricas
(1) -> a := 3 + sqrt 5

\label{eq1}{\sqrt{5}}+ 3(1)
Type: AlgebraicNumber?
fricas
(-a = (a^2)^(1/2))::Boolean

\label{eq2} \mbox{\rm false} (2)
Type: Boolean

But

fricas
(sqrt 2 = - sqrt 2)::Boolean

\label{eq3} \mbox{\rm false} (3)
Type: Boolean

I expect the same result, and I prefer false.

meaning of sqrt --Bill Page, Wed, 19 Apr 2006 10:30:27 -0500 reply
Do you consider \sqrt{2} to be a particular (single) solution of x^2-2=0, e.g. the positive one, or the general solution of this polynomial? I prefer the latter, so I think both (2) and (3) should be true.

meaning of sqrt --Bob McElrath?, Wed, 19 Apr 2006 11:11:19 -0500 reply
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.

fricas
sqrt(2)::Float

\label{eq4}1.4142135623 \<u> 730950488(4)
Type: Float

gives only one value.

Also note that axiom is not even self-consistent here:

fricas
-a::Float

\label{eq5}-{5.2360679774 \<u> 997896964}(5)
Type: Float
fricas
(a^2)^(1/2)::Float

\label{eq6}5.2360679774 \<u> 997896964(6)
Type: Expression(Float)

which clearly are not equal.

equality is domain specific --Bill Page, Wed, 19 Apr 2006 18:11:31 -0500 reply
If you write:
fricas
-a=(a^2)^(1/2)

\label{eq7}{-{\sqrt{5}}- 3}={\sqrt{{6 \ {\sqrt{5}}}+{14}}}(7)
Type: Equation(AlgebraicNumber?)
fricas
coerce(%%(7))$Equation(AlgebraicNumber)

\label{eq8} \mbox{\rm false} (8)
Type: Boolean

you are asking about equality in the domain of AlgebraicNumber? (whatever that happens to be). But if you write:

fricas
coerce(%%(7)::Equation(Float))$Equation(Float)

\label{eq9} \mbox{\rm false} (9)
Type: Boolean

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. :(

equality in AlgebraicNumber? --Bill Page, Wed, 19 Apr 2006 18:22:55 -0500 reply
From:

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. :(

equality in InnerAlgebraicNumber? --Bill Page, Wed, 19 Apr 2006 20:35:13 -0500 reply
InnerAlgebraicNumber? (IAN) is described as
Algebraic closure of the rational numbers.
while AlgebraicNumber? (AN) is described as
Algebraic closure of the rational numbers, with mathematical =

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

fricas
trueEqual(sqrt(2),-sqrt(2))$IAN
IAN is not a valid type.

So = in AN is not transitive. --William Sit, Wed, 19 Apr 2006 22:18:11 -0500 reply
This is quite strange. As I understand it, 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:
fricas
a:AN:=sqrt(5)+3

\label{eq10}{\sqrt{5}}+ 3(10)
Type: AlgebraicNumber?
fricas
b:=(a^2)^(1/2)

\label{eq11}\sqrt{{6 \ {\sqrt{5}}}+{14}}(11)
Type: AlgebraicNumber?
fricas
(a=b)::Boolean

\label{eq12} \mbox{\rm false} (12)
Type: Boolean
fricas
(a=-b)::Boolean

\label{eq13} \mbox{\rm false} (13)
Type: Boolean
fricas
(b=-b)::Boolean

\label{eq14} \mbox{\rm false} (14)
Type: Boolean
fricas
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.

fricas
trueEqual(g+g,0)
not the same as trueEqual(g, -g)
There are 1 exposed and 0 unexposed library operations named trueEqual having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op trueEqual to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named trueEqual with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

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

conjugacy relation is an equivalence relation --Bill Page, Thu, 20 Apr 2006 00:16:28 -0500 reply
http://mathworld.wolfram.com/ConjugateElements.html
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:

fricas
Ran := RealClosure( Fraction(Integer) )

\label{eq15}\hbox{\axiomType{RealClosure}\ } \left({\hbox{\axiomType{Fraction}\ } \left({\hbox{\axiomType{Integer}\ }}\right)}\right)(15)
Type: Type
fricas
a1:Ran := 3 + sqrt 5

\label{eq16}{\sqrt{5}}+ 3(16)
Type: RealClosure(Fraction(Integer))
fricas
(-a1 = (a1^2)^(1/2))::Boolean

\label{eq17} \mbox{\rm false} (17)
Type: Boolean
fricas
a2:=sqrt(2)$Ran

\label{eq18}\sqrt{2}(18)
Type: RealClosure(Fraction(Integer))
fricas
a3:=-sqrt(2)$Ran

\label{eq19}-{\sqrt{2}}(19)
Type: RealClosure(Fraction(Integer))
fricas
(a2=a3)::Boolean

\label{eq20} \mbox{\rm false} (20)
Type: Boolean

Status: open => closed




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: