[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] [#180 bug #9216 differentiating sums with respect to a
From: |
Bill Page |
Subject: |
[Axiom-developer] [#180 bug #9216 differentiating sums with respect to a bound is wrong] (new) bug #9216 differentiating sums with respect to a bound is wrong |
Date: |
Wed, 22 Jun 2005 15:07:28 -0500 |
Changes
http://page.axiom-developer.org/zope/mathaction/180Bug9216DifferentiatingSumsWithRespectToABoundIsWrong/diff
--
--removed:
-
++added:
Compile and Test
SPAD files for the functional world should be compiled in the
following order::
op kl function funcpkgs manip algfunc
elemntry constant funceval COMBFUNC fe
<pre>!\begin{axiom}
)abbrev category COMBOPC CombinatorialOpsCategory
++ Category for summations and products
++ Author: Manuel Bronstein
++ Date Created: ???
++ Date Last Updated: 22 February 1993 (JHD/BMT)
++ Description:
++ CombinatorialOpsCategory is the category obtaining by adjoining
++ summations and products to the usual combinatorial operations;
CombinatorialOpsCategory(): Category ==
CombinatorialFunctionCategory with
factorials : $ -> $
++ factorials(f) rewrites the permutations and binomials in f
++ in terms of factorials;
factorials : ($, Symbol) -> $
++ factorials(f, x) rewrites the permutations and binomials in f
++ involving x in terms of factorials;
summation : ($, Symbol) -> $
++ summation(f(n), n) returns the formal sum S(n) which verifies
++ S(n+1) - S(n) = f(n);
summation : ($, SegmentBinding $) -> $
++ summation(f(n), n = a..b) returns f(a) + ... + f(b) as a
++ formal sum;
product : ($, Symbol) -> $
++ product(f(n), n) returns the formal product P(n) which verifies
++ P(n+1)/P(n) = f(n);
product : ($, SegmentBinding $) -> $
++ product(f(n), n = a..b) returns f(a) * ... * f(b) as a
++ formal product;
)abbrev package COMBF CombinatorialFunction
++ Provides the usual combinatorial functions
++ Author: Manuel Bronstein
++ Date Created: 2 Aug 1988
++ Date Last Updated: 14 December 1994
++ Description:
++ Provides combinatorial functions over an integral domain.
++ Keywords: combinatorial, function, factorial.
++ Examples: )r COMBF INPUT
CombinatorialFunction(R, F): Exports == Implementation where
R: Join(OrderedSet, IntegralDomain)
F: FunctionSpace R
OP ==> BasicOperator
K ==> Kernel F
SE ==> Symbol
O ==> OutputForm
SMP ==> SparseMultivariatePolynomial(R, K)
Z ==> Integer
POWER ==> "%power"::Symbol
OPEXP ==> "exp"::Symbol
SPECIALDIFF ==> "%specialDiff"
SPECIALDISP ==> "%specialDisp"
Exports ==> with
belong? : OP -> Boolean
++ belong?(op) is true if op is a combinatorial operator;
operator : OP -> OP
++ operator(op) returns a copy of op with the domain-dependent
++ properties appropriate for F;
++ error if op is not a combinatorial operator;
"**" : (F, F) -> F
++ a ** b is the formal exponential a**b;
binomial : (F, F) -> F
++ binomial(n, r) returns the number of subsets of r objects
++ taken among n objects, i.e. n!/(r! * (n-r)!);
permutation: (F, F) -> F
++ permutation(n, r) returns the number of permutations of
++ n objects taken r at a time, i.e. n!/(n-r)!;
factorial : F -> F
++ factorial(n) returns the factorial of n, i.e. n!;
factorials : F -> F
++ factorials(f) rewrites the permutations and binomials in f
++ in terms of factorials;
factorials : (F, SE) -> F
++ factorials(f, x) rewrites the permutations and binomials in f
++ involving x in terms of factorials;
summation : (F, SE) -> F
++ summation(f(n), n) returns the formal sum S(n) which verifies
++ S(n+1) - S(n) = f(n);
summation : (F, SegmentBinding F) -> F
++ summation(f(n), n = a..b) returns f(a) + ... + f(b) as a
++ formal sum;
product : (F, SE) -> F
++ product(f(n), n) returns the formal product P(n) which verifies
++ P(n+1)/P(n) = f(n);
product : (F, SegmentBinding F) -> F
++ product(f(n), n = a..b) returns f(a) * ... * f(b) as a
++ formal product;
iifact : F -> F
++ iifact(x) should be local but conditional;
iibinom : List F -> F
++ iibinom(l) should be local but conditional;
iiperm : List F -> F
++ iiperm(l) should be local but conditional;
iipow : List F -> F
++ iipow(l) should be local but conditional;
iidsum : List F -> F
++ iidsum(l) should be local but conditional;
iidprod : List F -> F
++ iidprod(l) should be local but conditional;
ipow : List F -> F
++ ipow(l) should be local but conditional;
Implementation ==> add
ifact : F -> F
iiipow : List F -> F
iperm : List F -> F
ibinom : List F -> F
isum : List F -> F
idsum : List F -> F
iprod : List F -> F
idprod : List F -> F
ddsum : List F -> O
ddprod : List F -> O
ddiff : List F -> O
fourth : List F -> F
dvpow1 : List F -> F
dvpow2 : List F -> F
summand : List F -> F
dvsum : (List F, SE) -> F
dvdsum : (List F, SE) -> F
facts : (F, List SE) -> F
K2fact : (K, List SE) -> F
smpfact : (SMP, List SE) -> F
dummy == new()$SE :: F
-- this works if we don't accidently use such a symbol as a bound of summation
-- or product
opfact := operator("factorial"::Symbol)$CommonOperators
opperm := operator("permutation"::Symbol)$CommonOperators
opbinom := operator("binomial"::Symbol)$CommonOperators
opsum := operator("summation"::Symbol)$CommonOperators
opdsum := operator("%defsum"::Symbol)$CommonOperators
opprod := operator("product"::Symbol)$CommonOperators
opdprod := operator("%defprod"::Symbol)$CommonOperators
oppow := operator(POWER::Symbol)$CommonOperators
opdiff := operator("%diff"::Symbol)$CommonOperators
factorial x == opfact x
binomial(x, y) == opbinom [x, y]
permutation(x, y) == opperm [x, y]
import F
import Kernel F
number?(x:F):Boolean ==
if R has RetractableTo(Z) then
ground?(x) or
((retractIfCan(x)@Union(Fraction(Z),"failed")) case Fraction(Z))
else
ground?(x)
x ** y ==
-- Do some basic simplifications
is?(x,POWER) =>
args : List F := argument first kernels x
not(#args = 2) => error "Too many arguments to **"
number?(first args) and number?(y) =>
oppow [first(args)**y, second args]
oppow [first args, (second args)* y]
-- Generic case
exp : Union(Record(val:F,exponent:Z),"failed") := isPower x
exp case Record(val:F,exponent:Z) =>
expr := exp::Record(val:F,exponent:Z)
oppow [expr.val, (expr.exponent)*y]
oppow [x, y]
belong? op == has?(op, "comb")
fourth l == third rest l
dvpow1 l == second(l) * first(l) ** (second l - 1)
factorials x == facts(x, variables x)
factorials(x, v) == facts(x, [v])
facts(x, l) == smpfact(numer x, l) / smpfact(denom x, l)
summand l == eval(first l, retract(second l)@K, third l)
product(x:F, i:SE) ==
dm := dummy
opprod [eval(x, k := kernel(i)$K, dm), dm, k::F]
summation(x:F, i:SE) ==
dm := dummy
opsum [eval(x, k := kernel(i)$K, dm), dm, k::F]
dvsum(l, x) ==
k := retract(second l)@K
[456 more lines...]
--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden