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

Edit detail for Indefinite Types revision 2 of 2

1 2
Editor: test1
Time: 2018/02/17 15:53:14 GMT+0
Note:

changed:
-variable in Axiom by the command
variable in FriCAS by the command

changed:
-is a frequent expectation of new users of Axiom - especially if one
-has used other computer algebra systems, after all Axiom is supposed
is a frequent expectation of new users of FriCAS - especially if one
has used other computer algebra systems, after all FriCAS is supposed

changed:
-Unfortunately Axiom does not attempt to use this type information
Unfortunately FriCAS does not attempt to use this type information

changed:
-When you write 'n:PositiveInteger' what this tells Axiom is that
When you write 'n:PositiveInteger' what this tells FriCAS is that

changed:
-To me, this is a tremedous waste of an opportunity in Axiom to
To me, this is a tremedous waste of an opportunity in FriCAS to

Declaring Types

The idea that one should be able to "declare the type" of a variable in FriCAS by the command

fricas
(1) -> n:PositiveInteger
Type: Void

is a frequent expectation of new users of FriCAS - especially if one has used other computer algebra systems, after all FriCAS is supposed to be a "strongly typed" system, right?

Unfortunately FriCAS does not attempt to use this type information when forming expressions - but worse - declaring the type actually interferes with the use of the variable to form expressions!

fricas
n+1
n is declared as being in PositiveInteger but has not been given a value.

When you write n:PositiveInteger what this tells FriCAS is that n will be assigned an integer value greater than 0 - only that. After it is actually assigned some value, then it can be used exactly like that value, but not before.

To me, this is a tremedous waste of an opportunity in FriCAS to to deal with "domain of computation" issues such as are addressed in other untyped computer algebra systems by the use of "assumptions" such as:

  assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality and generality of the computations.

There was plenty of discussion on axiom-developer, but no concensus yet, I'm afraid. Here are some of the related threads:

See also The Unknown In Computer Algebra

pdf format --Bill Page, Tue, 19 Sep 2006 09:21:21 -0500 reply
Article by James Davenport and Christèle Faure in pdf format:

The Unknown In Computer Algebra

example code from above --Bill Page, Tue, 19 Sep 2006 09:52:30 -0500 reply
spad
)abbrev domain PUNINT PureUnknownInteger
PureUnknownInteger (D,BasicUnknown):Ring == Implementation where
    D:IntegerNumberSystem
    BasicUnknown:List Symbol
  Implementation ==> LocalAlgebra (Polynomial D,D,D) with
    "/" : ($,D) -> $
    ++ a/n computes the expression whose value is a/n if it
    ++ is actually an unknown integer
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7349452271109161057-25px003.spad
      using old system compiler.
   PUNINT abbreviates domain PureUnknownInteger 
******** Spad syntax error detected ********
Expected: |)|
The prior line was:
5> Implementation ==> LocalAlgebra (Polynomial D,D,D) with
The current line is:
6> "/" : ($,D) -> $
The number of valid tokens is 1. The prior token was #S(TOKEN :SYMBOL |(| :TYPE KEYWORD :NONBLANK NIL :LINE_NUM 6 :CHAR_NUM 10) The current token is #S(TOKEN :SYMBOL $ :TYPE KEYWORD :NONBLANK NIL :LINE_NUM 6 :CHAR_NUM 11)