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
Type: Type
fricas
q:Q
Type: Void
fricas
q:=quatern(1+%i*3,2-%i,3,4)
Type: Quaternion(Complex(Expression(Integer)))
fricas
q:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)
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)
Type: Quaternion(Polynomial(Complex(Integer)))
fricas
quatern(1+%i*3,2-%i+t,3,4)::Q
Cannot convert from type Quaternion(Polynomial(Complex(Integer))) to
Quaternion(Complex(Expression(Integer))) for value
1 + 3%i + (t + 2 - %i)i + 3j + 4k
Probably we shoud enhance coercions to handle this case...
Such a coercion exists in the follow similar case:
fricas
QP:=Quaternion Complex Fraction Polynomial Integer
Type: Type
fricas
qp:QP
Type: Void
fricas
qp:=quatern(1+%i*3,2-%i,3,4)
Type: Quaternion(Complex(Fraction(Polynomial(Integer))))
fricas
qp:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)
Type: Quaternion(Complex(Fraction(Polynomial(Integer))))
fricas
qp:=quatern(1+%i*3,2-%i+t,3,4)
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
Type: Type
fricas
t:C
Type: Void
fricas
QC:=Quaternion C
Type: Type
fricas
qc:QC
Type: Void
fricas
qc:=quatern(1+%i*3,2-%i,3,4)
Type: Quaternion(Complex(Expression(Integer)))
fricas
qc:=quatern(1+%i*3,2-%i,3+t,4+t+t^2)
Type: Quaternion(Complex(Expression(Integer)))
fricas
qc:=quatern(1+%i*3,2-%i+t,3,4)
Type: Quaternion(Complex(Expression(Integer)))
The formatting of the error message:
Function: coerce : Quaternion Complex Integer -> % is missing from
domain: Expression Quaternion Complex Integer
Internal Error
The function coerce with signature $(Quaternion (Complex (Integer))) is
missing from domain Expression(Quaternion (Complex (Integer)))
also leaves a lot to be desired. Why is it said twice, the second time badly?