I have the following package:

)abbrev package GGLC GeographicLibCoefficients
GeographicLibCoefficients() : Exports == Implementation where

        L ==> List
        I ==> Integer
        P ==> PositiveInteger

        EXPR ==> Expression(I)

        RAT ==> Fraction(I)
        PLY ==> Polynomial(RAT)
        UPLY(var) ==> UnivariatePolynomial(var, RAT)
        RATFUNC ==> Fraction(PLY)
        TAY(var) ==> UnivariateTaylorSeries(EXPR, var, 0)

        Exports ==> with

                tau1_m_sigma: () -> EXPR

        Implementation ==> add

                maxpow(): P ==
                        8

                tau1_m_sigma(): EXPR ==
                        integrand: EXPR := sqrt(1 + 'k2 * sin('sigma)^2)
                        I1: TAY('eps) := integrate(taylor(
                                                 subst(integrand,
                                                       'k2 = 4 * 'eps
/ (1 - 'eps)^2) *
                                                         (1 - 'eps),
                                                 'eps = 0),
                                                'sigma)
                        I1_truncated: EXPR := reduce(_+,
                                                           [coefficient(I1, n) *
                                                             'eps^n for
                                                            n in 0..maxpow()])
                        A1: UPLY('eps) := simplify(subst(I1_truncated,
                                                               'sigma = 2*%pi) /
                                                    (2*%pi))
                        tau1: EXPR := I1_truncated / A1
                        tau1 - sigma


This is me trying to compile the package:


(1) -> )compile test.spad
   Compiling FriCAS source code from file /tmp/spad_test/test.spad
      using old system compiler.
   GGLC abbreviates package GeographicLibCoefficients
------------------------------------------------------------------------
   initializing NRLIB GGLC for GeographicLibCoefficients
   compiling into NRLIB GGLC
   compiling local maxpow : () -> PositiveInteger
      GGLC;maxpow is replaced by 8
Time: 0.00 SEC.

   compiling exported tau1_m_sigma : () -> Expression Integer
****** comp fails at level 7 with expression: ******
error in function tau1_m_sigma

(SEQ
 (|:=| (|:| |integrand| (|Expression| (|Integer|)))
  (|sqrt| (+ 1 (* '|k2| (^ | << | (|sin| '|sigma|) | >> | 2)))))
 (|:=| (|:| I1 (|UnivariateTaylorSeries| (|Expression| (|Integer|)) '|eps| 0))
  (|integrate|
   (|taylor|
    (* (|subst| |integrand| (= '|k2| (/ (* 4 '|eps|) (^ (- 1 '|eps|) 2))))
       (- 1 '|eps|))
    (= '|eps| 0))
   '|sigma|))
 (|:=| (|:| |I1_truncated| (|Expression| (|Integer|)))
  (|reduce| +
   (COLLECT (IN |n| (SEGMENT 0 (|maxpow|)))
            (* (|coefficient| I1 |n|) (^ '|eps| |n|)))))
 (|:=| (|:| A1 (|UnivariatePolynomial| '|eps| (|Fraction| (|Integer|))))
  (|simplify|
   (/ (|subst| |I1_truncated| (= '|sigma| (* 2 |%pi|))) (* 2 |%pi|))))
 (|:=| (|:| |tau1| (|Expression| (|Integer|))) (/ |I1_truncated| A1))
 (|exit| 1 (- |tau1| |sigma|)))
****** level 7  ******
$x:= (sin (QUOTE sigma))
$m:= $EmptyMode
$f:=
((((|integrand| #) (|maxpow| #) (* #) (+ #) ...)))

   >> Apparent user error:
   Cannot coerce (QUOTE sigma)
      of mode (Symbol)
      to mode (Expression (Integer))


I notice that Fricas says that it can't coerce a Symbol to an
Expression. Is that a bug, or do I really have to convert symbols into
expressions explicitly?


Thanks,
Neven

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/CAL%2BbK4N5FnJWOAzQovABKZxi_fuQegTdarVYm5pprye8ROOtqw%40mail.gmail.com.

Reply via email to