login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit
spad
-- Copyright (C) 2006 Martin Rubey <Martin.Rubey@univie.ac.at>
-- This program is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License as -- published by the Free Software Foundation; either version 2 of -- the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be -- useful, but WITHOUT ANY WARRANTY; without even the implied -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -- PURPOSE. See the GNU General Public License for more details. )abbrev domain SUPEXPR SparseUnivariatePolynomialExpressions SparseUnivariatePolynomialExpressions(R: Ring): Exports == Implementation where Exports == UnivariatePolynomialCategory R with if R has TranscendentalFunctionCategory then TranscendentalFunctionCategory Implementation == SparseUnivariatePolynomial R add if R has TranscendentalFunctionCategory then exp(p: %): % == ground? p => coerce exp ground p output(hconcat("exp p for p= ", p::OutputForm))$OutputPackage error "SUPTRAFUN: exp only defined for elements of the coefficient ring" sin(p: %): % == ground? p => coerce sin ground p output(hconcat("sin p for p= ", p::OutputForm))$OutputPackage error "SUPTRAFUN: sin only defined for elements of the coefficient ring" asin(p: %): % == ground? p => coerce asin ground p output(hconcat("asin p for p= ", p::OutputForm))$OutputPackage error "SUPTRAFUN: asin only defined for elements of the coefficient ring" cos(p: %): % == ground? p => coerce cos ground p output(hconcat("cos p for p= ", p::OutputForm))$OutputPackage error "SUPTRAFUN: cos only defined for elements of the coefficient ring" acos(p: %): % == ground? p => coerce acos ground p output(hconcat("acos p for p= ", p::OutputForm))$OutputPackage error "SUPTRAFUN: acos only defined for elements of the coefficient ring" )abbrev package UTSSOL TaylorSolve TaylorSolve(F, UTSF, UTSSUPF): Exports == Implementation where F: Field SUP ==> SparseUnivariatePolynomialExpressions UTSF: UnivariateTaylorSeriesCategory F UTSSUPF: UnivariateTaylorSeriesCategory SUP F NNI ==> NonNegativeInteger Exports == with seriesSolve: (UTSSUPF -> UTSSUPF, List F) -> UTSF Implementation == add seriesSolve(f, l) == c1 := map(#1::(SUP F), l)$ListFunctions2(F, SUP F)::(Stream SUP F) coeffs: Stream SUP F := concat(c1, generate(monomial(1$F,1$NNI))) -- coeffs: Stream SUP F := concat(c1, monomial(1$F,1$NNI)) st: List Stream SUP F := [coeffs, coeffs] next: () -> F := nr := st.1 res: F if ground?(coeff: SUP F := nr.1)$(SUP F) then res := ground coeff st.1 := rest nr else ns := st.2 eqs: Stream SUP F := coefficients f series ns while zero? first eqs repeat eqs := rest eqs eq: SUP F := first eqs if degree eq > 1 then if monomial? eq then res := 0 else output(hconcat("The equation is: ", eq::OutputForm)) $OutputPackage error "seriesSolve: equation for coefficient not linear" else res := (-coefficient(eq, 0$NNI)$(SUP F) /coefficient(eq, 1$NNI)$(SUP F)) nr.1 := res::SUP F -- concat!(st.2, monomial(1$F,1$NNI)) st.1 := rest nr res series generate next )abbrev package EXPRSOL ExpressionSolve ExpressionSolve(R, F, UTSF, UTSSUPF): Exports == Implementation where R: Join(OrderedSet, IntegralDomain, ConvertibleTo InputForm) F: FunctionSpace R UTSF: UnivariateTaylorSeriesCategory F SUP ==> SparseUnivariatePolynomialExpressions UTSSUPF: UnivariateTaylorSeriesCategory SUP F OP ==> BasicOperator SY ==> Symbol NNI ==> NonNegativeInteger MKF ==> MakeBinaryCompiledFunction(F, UTSSUPF, UTSSUPF, UTSSUPF) Exports == with seriesSolve: (F, OP, SY, List F) -> UTSF Implementation == add opelt := operator(elt)$OP opdiff := operator(D)$OP opcoerce := operator(coerce)$OP replaceDiffs: (F, OP, Symbol) -> F replaceDiffs (expr, op, sy) == lk := kernels expr for k in lk repeat if freeOf?(coerce k, sy) then expr := subst(expr, [k], [opcoerce [coerce k]]) if is?(k, op) then arg := first argument k if arg = sy::F then expr := subst(expr, [k], [(name op)::F]) else expr := subst(expr, [k], [opelt [(name op)::F, replaceDiffs(arg, op, sy)]]) -- => "iterate" if is?(k, %diff) then args := argument k differentiand := replaceDiffs(subst(args.1, args.2 = args.3), op, sy) expr := subst(expr, [k], [opdiff differentiand]) -- => "iterate" expr seriesSolve(expr, op, sy, l) == ex := replaceDiffs(expr, op, sy) f := compiledFunction(ex, name op, sy)$MKF seriesSolve(f(#1, monomial(1,1)$UTSSUPF), l)$TaylorSolve(F, UTSF, UTSSUPF)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/2554171598177853288-25px001.spad using 
      old system compiler.
   SUPEXPR abbreviates domain SparseUnivariatePolynomialExpressions 
------------------------------------------------------------------------
   initializing NRLIB SUPEXPR for SparseUnivariatePolynomialExpressions 
   compiling into NRLIB SUPEXPR 
****** Domain: R already in scope
augmenting R: (TranscendentalFunctionCategory)
   compiling exported exp : $ -> $
Time: 0.28 SEC.
   compiling exported sin : $ -> $
Time: 0 SEC.
   compiling exported asin : $ -> $
Time: 0.02 SEC.
   compiling exported cos : $ -> $
Time: 0.01 SEC.
   compiling exported acos : $ -> $
Time: 0.01 SEC.
augmenting (SingletonAsOrderedSet): (ConvertibleTo (InputForm))
****** Domain: R already in scope
augmenting R: (ConvertibleTo (InputForm))
augmenting (SingletonAsOrderedSet): (ConvertibleTo (Pattern (Float)))
****** Domain: R already in scope
augmenting R: (ConvertibleTo (Pattern (Float)))
augmenting (SingletonAsOrderedSet): (ConvertibleTo (Pattern (Integer)))
****** Domain: R already in scope
augmenting R: (ConvertibleTo (Pattern (Integer)))
augmenting (SingletonAsOrderedSet): (PatternMatchable (Float))
****** Domain: R already in scope
augmenting R: (PatternMatchable (Float))
augmenting (SingletonAsOrderedSet): (PatternMatchable (Integer))
****** Domain: R already in scope
augmenting R: (PatternMatchable (Integer))
****** Domain: $ already in scope
augmenting $: (CharacteristicNonZero)
****** Domain: R already in scope
augmenting R: (PolynomialFactorizationExplicit)
****** Domain: $ already in scope
augmenting $: (CharacteristicNonZero)
****** Domain: R already in scope
augmenting R: (PolynomialFactorizationExplicit)
****** Domain: R already in scope
augmenting R: (Algebra (Fraction (Integer)))
****** Domain: R already in scope
augmenting R: (Algebra (Fraction (Integer)))
****** Domain: R already in scope
augmenting R: (CommutativeRing)
****** Domain: R already in scope
augmenting R: (Field)
****** Domain: R already in scope
augmenting R: (GcdDomain)
****** Domain: R already in scope
augmenting R: (IntegralDomain)
****** Domain: R already in scope
augmenting R: (LinearlyExplicitRingOver (Integer))
****** Domain: R already in scope
augmenting R: (OrderedSet)
****** Domain: R already in scope
augmenting R: (PartialDifferentialRing (Symbol))
****** Domain: R already in scope
augmenting R: (PolynomialFactorizationExplicit)
****** Domain: R already in scope
augmenting R: (RetractableTo (Fraction (Integer)))
****** Domain: R already in scope
augmenting R: (RetractableTo (Integer))
****** Domain: R already in scope
augmenting R: (StepThrough)
****** Domain: R already in scope
augmenting R: (TranscendentalFunctionCategory)
(time taken in buildFunctor:  70)
;;;     ***       |SparseUnivariatePolynomialExpressions| REDEFINED
;;;     ***       |SparseUnivariatePolynomialExpressions| REDEFINED
Time: 0.88 SEC.
   Cumulative Statistics for Constructor SparseUnivariatePolynomialExpressions
      Time: 1.20 seconds
--------------non extending category----------------------
.. SparseUnivariatePolynomialExpressions #1 of cat 
(|Join| (|UnivariatePolynomialCategory| |#1|)
        (CATEGORY |package|
            (IF (|has| |#1| (|TranscendentalFunctionCategory|))
                (ATTRIBUTE (|TranscendentalFunctionCategory|))
                |noBranch|)))    has no  outputForm : (%,OutputForm) -> OutputForm 
   finalizing NRLIB SUPEXPR 
   Processing SparseUnivariatePolynomialExpressions for Browser database:
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/SUPEXPR.spad-->SparseUnivariatePolynomialExpressions(): Missing Description
------------------------------------------------------------------------
   SparseUnivariatePolynomialExpressions is now explicitly exposed in 
      frame initial 
   SparseUnivariatePolynomialExpressions will be automatically loaded 
      when needed from /var/zope2/var/LatexWiki/SUPEXPR.NRLIB/code
   UTSSOL abbreviates package TaylorSolve 
   processing macro definition SUP ==> SparseUnivariatePolynomialExpressions 
   processing macro definition NNI ==> NonNegativeInteger 
------------------------------------------------------------------------
   initializing NRLIB UTSSOL for TaylorSolve 
   compiling into NRLIB UTSSOL 
   compiling exported seriesSolve : (UTSSUPF -> UTSSUPF,List F) -> UTSF
Time: 2.26 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |TaylorSolve| REDEFINED
;;;     ***       |TaylorSolve| REDEFINED
Time: 0 SEC.
   Warnings: 
      [1] seriesSolve:  res has no value
   Cumulative Statistics for Constructor TaylorSolve
      Time: 2.26 seconds
   finalizing NRLIB UTSSOL 
   Processing TaylorSolve for Browser database:
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/UTSSOL.spad-->TaylorSolve((seriesSolve (UTSF (Mapping UTSSUPF UTSSUPF) (List F)))): Not documented!!!!
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/UTSSOL.spad-->TaylorSolve(constructor): Not documented!!!!
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/UTSSOL.spad-->TaylorSolve(): Missing Description
------------------------------------------------------------------------
   TaylorSolve is now explicitly exposed in frame initial 
   TaylorSolve will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/UTSSOL.NRLIB/code
   EXPRSOL abbreviates package ExpressionSolve 
   processing macro definition SUP ==> SparseUnivariatePolynomialExpressions 
   processing macro definition OP ==> BasicOperator 
   processing macro definition SY ==> Symbol 
   processing macro definition NNI ==> NonNegativeInteger 
   processing macro definition MKF ==> MakeBinaryCompiledFunction(F,UTSSUPF,UTSSUPF,UTSSUPF) 
------------------------------------------------------------------------
   initializing NRLIB EXPRSOL for ExpressionSolve 
   compiling into NRLIB EXPRSOL 
****** Domain: R already in scope
****** Domain: R already in scope
   compiling local replaceDiffs : (F,BasicOperator,Symbol) -> F
Time: 0.48 SEC.
   compiling exported seriesSolve : (F,BasicOperator,Symbol,List F) -> UTSF
Time: 0.15 SEC.
(time taken in buildFunctor:  0)
;;;     ***       |ExpressionSolve| REDEFINED
;;;     ***       |ExpressionSolve| REDEFINED
Time: 0 SEC.
   Warnings: 
      [1] replaceDiffs: not known that (OrderedSet) is of mode (CATEGORY package (SIGNATURE seriesSolve (UTSF F (BasicOperator) (Symbol) (List F))))
      [2] replaceDiffs:  %diff has no value
   Cumulative Statistics for Constructor ExpressionSolve
      Time: 0.63 seconds
   finalizing NRLIB EXPRSOL 
   Processing ExpressionSolve for Browser database:
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/EXPRSOL.spad-->ExpressionSolve((seriesSolve (UTSF F OP SY (List F)))): Not documented!!!!
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/EXPRSOL.spad-->ExpressionSolve(constructor): Not documented!!!!
--->/usr/local/lib/axiom/target/x86_64-unknown-linux/../../src/algebra/EXPRSOL.spad-->ExpressionSolve(): Missing Description
------------------------------------------------------------------------
   ExpressionSolve is now explicitly exposed in frame initial 
   ExpressionSolve will be automatically loaded when needed from 
      /var/zope2/var/LatexWiki/EXPRSOL.NRLIB/code




subject:
  ( 7 subscribers )  
Please rate this page: