There seems to be a problem with Axiom's ContinuedFractions? domain.
The type of the result is shown as Something similar happens if the argument is Fraction Integer fricas )set functions compile on Type: Void
fricas dene(a, Type: Void
fricas cfe(a, Type: Void
fricas ccfe(a, Type: Void
fricas ccfe(0, fricas Compiling function nume with type NonNegativeInteger -> Stream( Integer) fricas Compiling function dene with type (NonNegativeInteger, fricas Compiling function cfe with type (NonNegativeInteger, fricas Compiling function ccfe with type (NonNegativeInteger,
Type: Stream(Fraction(Float))
fricas ccfe(0, fricas Compiling function dene with type (NonNegativeInteger, fricas Compiling function cfe with type (NonNegativeInteger, fricas Compiling function ccfe with type (NonNegativeInteger,
Type: Stream(Fraction(Fraction(Integer)))
fricas ff1:Fraction Float ... --kratt6, Fri, 03 Feb 2006 03:24:30 -0600 reply Well, this is a general problem: when a constructor takes a parameter R , it is often natural to return something of type Fraction R . I see two possible solutions:
In the case above I see another problem: fricas n := nume(0.2) fricas Compiling function nume with type Float -> Stream(Float)
Type: Stream(Float)
fricas d := dene(0.2, fricas Compiling function dene with type (Float,
Type: Stream(Polynomial(Float))
fricas continuedFraction(0, (note that there is no output...) This makes very good sense to me. Is Field the right type or something more general?But is this possible in Axiom? How would I modify [Fraction]? to make this happen? Thinking about it, I realized that this is not the proper solution, sinceFraction R provides some operations, for example denominator which R does not necessarily have and I think it would be wrong to equip every Field with this operation, which would then be necessary. Thus, either
The code that excludes constructions like Possibly we want to allow Martin Since "add { ... }" is a value in Aldor/Axiom, [Fraction]? should/could be implemented as follows:spad Fraction(S: IntegralDomain): QuotientFieldCategory S with ... == if S has Field then S add -- additional functions like "denom" etc. else ... add -- old code goes here spad Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/3103239194962224468-25px004.spad using old system compiler. ******** Spad syntax error detected ******** The current line is: Well, that means the representation of I think Axiom's two-level type system is going to get in the way. Although it is true that types in Axiom are "first order objects" in the sense that we can assign them to variables etc., the kind of things that we can actually do with them is very limited. For example, I see no way in Axiom, SPAD or Aldor to have: FRAC FRAC INT = FRAC INT since fType(x) == x=0 ==> Integer Float t:fType(1):=1.0 because types like Or do I not understand something quite fundamental here? Perhaps what you are suggesting amounts to ensuring that, as types these two are at least functionally equivalent? Martin wrote:Note that you can perfectly well calculate with objects of type Stream Fraction Fraction Integer, no problem occurs. I don't think you can calculate reliably with these strange types. I get bizarre results and sometimes Axiom crashes when I try things that should work. For example, this works: fricas cff1:=continuedFraction(0,
Type: ContinuedFraction?(Integer)
fricas 4*cff1
Type: ContinuedFraction?(Integer)
fricas cff2:=continuedFraction(0,
Type: ContinuedFraction?(Fraction(Integer))
But the following code sends Axiom into an infinite loop: 1/4*cff2Category: Axiom Mathematics => Axiom Library |