Leon Baum wrote:
> 
> Hello,
> 
> I am trying to compile Wilfrid Kendall's itovsn3 code found here:
> http://axiom.newsynthesis.org/mathaction/SymbolicItoCalculus
> 
> I am running into two errors with the ito.spad file, but because the
> code is old and I am new to axiom, I'm not sure whether the problems
> are with the code itself or with fricas.
> 
> 
> 
> 1) The first error is from the function:
> 
>    smooth!(op:BOP):Union(BOP,"failed")==
>     assert(op,"ito")
> 
> where  BOP  ==> BasicOperator
> 
> Error:
> 
> (|assert| |op| | << ito >> |)
> ****** level 2  ******
> $x:= ito
> $m:= (Symbol)
> $f:=
> ((((|op| # #) (< #) (<= #) (= #) ...)))
> 
>    >> Apparent user error:
>    Cannot coerce ito
>       of mode ito
>       to mode (Union ito (Symbol))
> 
> 
> I can get it to compile by using "ito"::Symbol, but why isn't the
> conversion automatic?
> >From the command line, assert(operator(foo), "bar") works.
> 
> 
> 
> 2) The second error is from the function:
> 
>    d(X:EXR):SDR ==
>     0 = height X => 0$SDR
>     f  := numerator X
>     g  := denominator X
>     df := ItoDPoly(numer f)
>     dg := ItoDPoly(numer g)
>     (g*df - f*dg)/g**2 - df*dg/g**2 + f*dg**2/g**3
> 
> where R is of type Join(OrderedSet, IntegralDomain)
> and EXR  ==> Expression(R)
> and  SDR  ==> StochasticDifferential(R)
> 
> Error:
> 
> (SEQ
>  (LET #1=#:G696
>    (= 0 (|height| X)))
>  (|exit| 1
>   (IF #1#
>       (|elt| (|StochasticDifferential| R) 0)
>       (SEQ
>        (LET |f|
>          (|numerator| X))
>        (LET |g|
>          (|denominator| X))
>        (LET |df|
>          (|ItoDPoly| (|numer| |f|)))
>        (LET |dg|
>          (|ItoDPoly| (|numer| |g|)))
>        (|exit| 1
>         (+
>          (- (/ (- (* |g| |df|) (* |f| |dg|)) (** | << g >> | 2))
>             (/ (* |df| |dg|) (** |g| 2)))
>          (/ (* |f| (** |dg| 2)) (** |g| 3))))))))
> ****** level 10  ******
> $x:= g
> $m:= (StochasticDifferential R)
> $f:=
> ((((|dg| #) (|df| #) (|g| #) (|f| #) ...)))
> 
>    >> Apparent user error:
>    Cannot coerce g
>       of mode (Expression R)
>       to mode (StochasticDifferential R)
> 
> 
> I am not sure how to fix this one. Any ideas?
>


There were changes in FriCAS and the code needs to be updated:

1) In FriCAS operator properties are Symbols.  So

     assert(op,"ito")

should be changed to

     assert(op, 'ito)

Similarly

     has?(op,"ito")

should be changed to

     has?(op, 'ito)


2) FriCAS algebra uses '^' for exponentiation.  So

   g**2

should be changed to

   g^2

and similarly for other uses of '**'.

The two changes fix problems you observed.  For newest FriCAS you
also need to change:


   setSmooth:={
    'exp,'log,'sin,'cos,'tan,
     'cot,'sec,'csc,'asin,'acos,'atan,
      'acot,'asec,'acsc,'sinh,'cosh,'tanh,
       'coth,'sech,'csch,'asinh,'acosh,'atanh,
        'acoth,'asech,'acsch,'Gamma
         }::Set Symbol

to

   setSmooth:= set([
    'exp,'log,'sin,'cos,'tan,
     'cot,'sec,'csc,'asin,'acos,'atan,
      'acot,'asec,'acsc,'sinh,'cosh,'tanh,
       'coth,'sech,'csch,'asinh,'acosh,'atanh,
        'acoth,'asech,'acsch,'Gamma
         ])$Set(Symbol)

This is beacause newest FriCAS does not allow to use { and } to
denote sets -- the idea is that braces for sets where used very
rarely and we want to free braces for other puroses.  Also,
this change removes one of disagreements between interpreter and
Spad compiler -- already in Axiom time interpreter did not
accept braces for sets.

Note that FriCAS interpreter language is slightly different than
Spad compiler language.  In particular interpreter automatically
coerces a String to a Symbol, but Spad compiler needs explicit
coercion (or better just a Symbol).  Also, for compatibility
with old code currently FriCAS interpreter allows '**' as
exponentiation and converts it to '^', but Spad compiler
treats '**' and '^' as distinct.   

-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to