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

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

The domain Expression(R:OrderedSet) should always be able to coerce something of type R to an Expression, but this fails in some cases. For example:

fricas
Q:=Quaternion Complex Expression Integer

\label{eq1}\hbox{\axiomType{Quaternion}\ } (\hbox{\axiomType{Complex}\ } (\hbox{\axiomType{Expression}\ } (\hbox{\axiomType{Integer}\ })))(1)
Type: Type
fricas
q:Q
Type: Void
fricas
q:=quatern(1+%i*3,2-%i,3,4)

\label{eq2}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{3 \  j}+{4 \  k}(2)
Type: Quaternion(Complex(Expression(Integer)))
fricas
q:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)

\label{eq3}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{{\left(t + 3 \right)}\  j}+{{\left({{t}^{2}}+ t + 4 \right)}\  k}(3)
Type: Quaternion(Complex(Expression(Integer)))
fricas
q:=quatern(1+%i*3,2-%i+t,3,4)
Cannot convert right-hand side of assignment 1 + 3%i + (t + 2 - %i)i + 3j + 4k
to an object of the type Quaternion(Complex(Expression(Integer))) of the left-hand side.

Actually, problem is because Axiom/FriCAS chooses different type for expression which it can not coerce to Q

fricas
quatern(1+%i*3,2-%i+t,3,4)

\label{eq4}1 +{3 \  i}+{{\left(t + 2 - i \right)}\  i}+{3 \  j}+{4 \  k}(4)
Type: Quaternion(Polynomial(Complex(Integer)))
fricas
quatern(1+%i*3,2-%i+t,3,4)::Q
Cannot convert the value from type Quaternion(Polynomial(Complex( Integer))) to Quaternion(Complex(Expression(Integer))) .

Probably we should enhance coercions to handle this case...

Such a coercion exists in the follow similar case:

fricas
QP:=Quaternion Complex Fraction Polynomial Integer

\label{eq5}\hbox{\axiomType{Quaternion}\ } (\hbox{\axiomType{Complex}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Polynomial}\ } (\hbox{\axiomType{Integer}\ }))))(5)
Type: Type
fricas
qp:QP
Type: Void
fricas
qp:=quatern(1+%i*3,2-%i,3,4)

\label{eq6}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{3 \  j}+{4 \  k}(6)
Type: Quaternion(Complex(Fraction(Polynomial(Integer))))
fricas
qp:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)

\label{eq7}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{{\left(t + 3 \right)}\  j}+{{\left({{t}^{2}}+ t + 4 \right)}\  k}(7)
Type: Quaternion(Complex(Fraction(Polynomial(Integer))))
fricas
qp:=quatern(1+%i*3,2-%i+t,3,4)

\label{eq8}1 +{3 \  i}+{{\left(t + 2 - i \right)}\  i}+{3 \  j}+{4 \  k}(8)
Type: Quaternion(Complex(Fraction(Polynomial(Integer))))

The error can also be avoided if more type information is provided since this changes the chain of inferences made by the Axiom intepreter:

fricas
C:=Complex Expression Integer

\label{eq9}\hbox{\axiomType{Complex}\ } (\hbox{\axiomType{Expression}\ } (\hbox{\axiomType{Integer}\ }))(9)
Type: Type
fricas
t:C
Type: Void
fricas
QC:=Quaternion C

\label{eq10}\hbox{\axiomType{Quaternion}\ } (\hbox{\axiomType{Complex}\ } (\hbox{\axiomType{Expression}\ } (\hbox{\axiomType{Integer}\ })))(10)
Type: Type
fricas
qc:QC
Type: Void
fricas
qc:=quatern(1+%i*3,2-%i,3,4)

\label{eq11}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{3 \  j}+{4 \  k}(11)
Type: Quaternion(Complex(Expression(Integer)))
fricas
qc:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)

\label{eq12}1 +{3 \  i}+{{\left(2 - i \right)}\  i}+{{\left(t + 3 \right)}\  j}+{{\left({{t}^{2}}+ t + 4 \right)}\  k}(12)
Type: Quaternion(Complex(Expression(Integer)))
fricas
qc:=quatern(1+%i*3,2-%i+t,3,4)

\label{eq13}1 +{3 \  i}+{{\left(t + 2 - i \right)}\  i}+{3 \  j}+{4 \  k}(13)
Type: Quaternion(Complex(Expression(Integer)))




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