## Martin's beautiful idea: We can use the Aldor aldor #include "axiom" aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/mymonoid.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. "/usr/local/aldor/linux/1.1.0/include/axiom.as", aldor #include "axiom" #library MyMonoid "mymonoid.ao"; import from MyMonoid; MyWord: with { coerce: String -> %; c:(%, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/9179840256381573157-25px002.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. #9 (Warning) Could not use archive file `libaxiom.al'. Program fault (segmentation violation).#10 (Error) Program fault (segmentation violation). "/usr/local/aldor/linux/1.1.0/include/axiom.as", This is what Axiom sees: fricas )sh MyMonoid fricas )sh MyWord Try it: fricas a := "Bingo"::MyWord That's pretty cool that Axiom knows But: fricas MyWord has MyMonoid(MyWord, Oops, that's Here are some more examples: aldor #include "axiom" #library MyMonoid "mymonoid.ao"; import from MyMonoid; MyInt: with { coerce: Integer -> %; +:(%, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/797595480097738355-25px006.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. #9 (Warning) Could not use archive file `libaxiom.al'. Program fault (segmentation violation).#10 (Error) Program fault (segmentation violation). "/usr/local/aldor/linux/1.1.0/include/axiom.as", This is what Axiom sees: fricas )sh MyInt Try it: fricas b := 3::MyInt
Type: Polynomial(Integer)fricas square b This is very general. Notice that we can rename the monoid operation from * to +! aldor #include "axiom" #library MyMonoid "mymonoid.ao"; import from MyMonoid; MyFloat: with { coerce: DoubleFloat -> %; +:(%, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4949806727147037492-25px009.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. #9 (Warning) Could not use archive file `libaxiom.al'. Program fault (segmentation violation).#10 (Error) Program fault (segmentation violation). "/usr/local/aldor/linux/1.1.0/include/axiom.as", This is what Axiom sees: fricas )sh MyFloat Try it: fricas f := 3.1::DoubleFloat::MyFloat
Type: Polynomial(Integer)fricas square f Here's a variation on the example aldor #include "axiom" define DirProdCat(n: Integer, aldor Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/mydirprod.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. #1 (Warning) Could not use archive file `libaxiom.al'. #2 (Warning) Could not use archive file `libaxiom.al'. "/usr/local/aldor/linux/1.1.0/include/axiom.as", Try it: fricas x:= Integer; Type: Typefricas y:= NonNegativeInteger; Type: Typefricas DPx ==> DirProd(2, Type: Voidfricas DPx has DirProdCat(2, The results show that the Aldor compiler treats a domain (R) and an element of a domain (n) differently in terms of information retained for the fricas )show DirProd(2, fricas )show DirProd(2, |