@Erik: this might help, but the best is to take the time to read the fricas 
user guide (as I'm myself doing) ric

fricas underlying language is strongly typed. You have to specify types (see 
f1,f2 below) or the interpreter will try to choose for you (see f3). Note that 
if you feed to f1  a float that cannot be recast to an integer without 
truncation you get an error. The last line shows how to see the signatures of 
the defined functions and their definition.

(1) ->  f1(x:Integer):Integer == x^2
   Function declaration f1 : Integer -> Integer has been added to
      workspace.
                                                                   Type: Void
(2) ->  f2(x:DoubleFloat):DoubleFloat == x^2
   Function declaration f2 : DoubleFloat -> DoubleFloat has been added
      to workspace.
                                                                   Type: Void
(3) -> f1(2)
   Compiling function f1 with type Integer -> Integer

   (3)  4
                                                        Type: PositiveInteger
(4) -> f1(2.0)

   (4)  4
                                                        Type: PositiveInteger
(5) -> f1(2.3)
   Conversion failed in the compiled user function f1 .
Cannot convert the value from type Float to Integer .

(5) -> f2(2.3)
   Compiling function f2 with type DoubleFloat -> DoubleFloat

   (5)  5.289999999999999
                                                            Type: DoubleFloat
(6) -> f2(2)

   (6)  4.0
                                                            Type: DoubleFloat
(7) -> f3(x) == x^2
                                                                   Type: Void
(8) -> f3(2)
   Compiling function f3 with type PositiveInteger -> PositiveInteger

   (8)  4
                                                        Type: PositiveInteger
(9) -> f3(2.3)
   Compiling function f3 with type Float -> Float

   (9)  5.29
                                                                  Type: Float
(10) -> )display properties f1 f2 f3
Properties of f1 :
   This is an interpreter function.
   Declared type or mode:   (Integer -> Integer)
                          2
   Definition:   f1 x == x
   Compiled function type: Float -> Integer
   Compiled function type: Integer -> Integer
Properties of f2 :
   This is an interpreter function.
   Declared type or mode:   (DoubleFloat -> DoubleFloat)
                          2
   Definition:   f2 x == x
   Compiled function type: Float -> DoubleFloat
   Compiled function type: DoubleFloat -> DoubleFloat
Properties of f3 :
   This is an interpreter function.
                          2
   Definition:   f3 x == x
   Compiled function type: Float -> Float
Compiled function type: PositiveInteger -> PositiveInteger
--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to