Skip to content

Internal Error: Unexpected error in call to system function compColon #62

@nsajko

Description

@nsajko

Moving on from the mailing list, since now I stumbled upon an actual bug in Fricas. This is the diagnostic produced by )compile:

   compiling local trunc_taylor_integral : (Expression Integer,Expression Integer) -> Expression Integer
   Internal Error
   Unexpected error in call to system function compColon

This is the code:

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

        SYM ==> Symbol

        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

                trunc_taylor_integral(integrand: EXPR, factor: EXPR): EXPR ==
                        subs_eq: Equation(EXPR) := 'k2::SYM::EXPR = 4 * 'eps::SYM::EXPR /
                                                                     (1 - 'eps::SYM::EXPR)^2
                        inte: EXPR := subst(integrand, subs_eq) * factor
                        tay: TAY('eps::SYM) := taylor(inte, 'eps:SYM = 0)
                        Inte: TAY('eps::SYM) := integrate(tay, 'sigma::SYM)
                        reduce(_+, [coefficient(Inte, n) * ('eps::SYM::EXPR)^n for n in 0..maxpow()])

                del_sigma(e: EXPR): UPLY('eps::SYM) ==
                        simplify(subst(e, 'sigma::SYM = 2*%pi) / (2*%pi))

                tau1_m_sigma(): EXPR ==
                        integrand: EXPR := sqrt(1 + 'k2::SYM::EXPR * sin('sigma::SYM::EXPR)^2)
                        I1_truncated: EXPR := trunc_taylor_integral(integrand,
                                                                          1 - 'eps::SYM::EXPR)
                        A1: UPLY('eps::SYM) := del_sigma(I1_truncated)
                        tau1: EXPR := I1_truncated / A1::EXPR
                        tau1 - 'sigma::SYM::EXPR

EDIT: the error is the same with this change:

                trunc_taylor_integral(integrand: EXPR, factor: EXPR): EXPR ==
                        subs_eq: Equation(EXPR) := 'k2::SYM::EXPR = 4 * 'eps::SYM::EXPR /
                                                                     (1 - 'eps::SYM::EXPR)^2
                        inte: EXPR := subst(integrand, subs_eq) * factor
                        terms: L(EXPR) := [coefficient(taylor(inte, 'eps:SYM = 0), n) *
                                             ('eps::SYM::EXPR)^n for n in 0..maxpow()]
                        tay: EXPR := reduce(_+, terms)
                        integrate(tay, 'sigma::SYM)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions