[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] series for sums
From: |
Martin Rubey |
Subject: |
[Axiom-developer] series for sums |
Date: |
Fri, 7 Oct 2005 16:13:20 +0200 |
Dear all,
in an attempt to teach axiom to handle limits of sums and products, as in
limit(product((1-q^(N-i))/(1-q^(m-i)),i=0..m-1),q=1)
I ended up with the following patch to fs2ups.spad
kernelToUPS(ker,posCheck?,atanFlag) ==
-- converts a kernel to a power series
(sym := symbolIfCan(ker)) case Symbol =>
(sym :: Symbol) = x => [monomial(1,1)]
[monomial(ker :: FE,0)]
empty?(args := argument ker) => [monomial(ker :: FE,0)]
not member?(x, variables(ker :: FE)) => [monomial(ker :: FE,0)]
empty? rest args =>
arg := first args
is?(ker,"abs" :: Symbol) =>
nthRootToUPS(arg*arg,2,posCheck?,atanFlag)
is?(ker,"%paren" :: Symbol) => exprToUPS(arg,posCheck?,atanFlag)
is?(ker,"log" :: Symbol) => logToUPS(arg,posCheck?,atanFlag)
is?(ker,"exp" :: Symbol) =>
applyIfCan(expIfCan,arg,"exp",posCheck?,atanFlag)
tranToUPS(ker,arg,posCheck?,atanFlag)
is?(ker,"%power" :: Symbol) => powToUPS(args,posCheck?,atanFlag)
is?(ker,"nthRoot" :: Symbol) =>
n := retract(second args)@I
nthRootToUPS(first args,n :: NNI,posCheck?,atanFlag)
! is?(ker,"%defsum" :: Symbol) =>
! (summand := exprToUPS(first args,posCheck?,atanFlag)) case %problem =>
! summand
! op := operator("%defsum"::Symbol)$CommonOperators
! mp:FE->FE:=op cons(#1, rest args)
! [map(mp, summand.%series)$UPS]
stateProblem(string name ker,"unknown kernel")
which nearly works. In fact, mathematically, everything is (nearly)
OK. However, there is an evaluation problem:
(58) -> series(sum(i^x,i=1..m),x=1)
(58)
%defsum(%CD,%CD,i,1,m) + %defsum(%CD log(%CD),%CD,i,1,m)(x - 1)
+
2
%CD log(%CD) 2 3
%defsum(-------------,%CD,i,1,m)(x - 1) + O((x - 1) )
2
Type: UnivariatePuiseuxSeries(Expression Integer,x,1)
Does anybody know how to make axiom to evaluate these sums? Note that
%defsum(%CD,%CD,i,1,m) is
sum(i,i=1..m)=m*(m+1)/2
of course, %defsum(%CD log(%CD),%CD,i,1,m) will not simplify, it should simply
be displayed as a sum. I suspect that the problem is in map$UPS, but I don't
really know...
Martin
- [Axiom-developer] series for sums,
Martin Rubey <=