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

Declaring Types

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

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!

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:


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
)abbrev domain PUNINT PureUnknownInteger
PureUnknownInteger (D,BasicUnknown):Ring == Implementation where
    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
   Compiling FriCAS source code from file 
      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)

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