Mar 27, 2010

Sum of Moebius function of n over its divisors

This text shows the calculation of sum of möbius function of n over the divisors of n.

Maxima 5.20.0 http://maxima.sourceforge.net
using Lisp CMU Common Lisp 19f (19F)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) block(load(("/Users/yasube/Programming/imaxima-imath/imaxima.lisp")), linenum:0)$

(%i1) dsum(exp, var, N) ::=
if integerp(N)
then buildq([exp:exp,var:var,N:N],block([res:0,divlist:listify(divisors(N))], for var in divlist do res:res+exp, return(res)))
else apply(nounify(dsum),[exp,var,N])$

(%i2) texput(nounify(dsum),
lambda([arglist], block([e,v,pm],[e,v,pm]:args(arglist),
concat("\\sum_{",tex1(v) ,"|",tex1(pm),"}",tex1(e)))))$

(%i3) texput(moebius, "\\mu");


We already learned the following equation, representing the Dirichlet series generating function for möbius function.
 
(%i4) moe0:sum(moebius(n)/n^s,n,1,inf)=1/zeta(s);


(%i5) moe1:moe0*zeta(s);


(%i6) subst(sum(1/n^s,n,1,inf),zeta(s),moe1);


 

We also learned that the multiplication of two Dirichlet series results also a Dirichlet series of convolution product.
(%i7) moe2:sum(a(n)/n^s,n,1,inf)*sum(b(n)/n^s,n,1,inf)=sum(dsum(a(d)*b(n/d),d,n)/n^s,n,1,inf);


 
Using this, we can calculate the left hand side of (%o6).
(%i8) moe3:moe2,a(n):=moebius(n),b(n):=1;


(%i9) rhs(moe3)=1;


 
 Hence, if n=1,
 (%i10) dsum(moebius(d),d,n)=1;


if n>1 then,
(%i11) dsum(moebius(d),d,n)=0;


(%i12)

 

Mar 14, 2010

dsum : Sum over divisors

This article demonstrates the defining of dsum, sum over divisors on given number N. As before, the tex output definition is also presented using texput(). Few of the trivial examples are given, too.

Maxima 5.20.0 http://maxima.sourceforge.net
using Lisp CMU Common Lisp 19f (19F)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) block(load(("/Users/yasube/Programming/imaxima-imath/imaxima.lisp")), linenum:0)$

(%i1) kill(all);


(%i1) dsum(exp, var, N) ::=
if integerp(N)
then buildq([exp:exp,var:var,N:N],block([res:0,divlist:listify(divisors(N))], for var in divlist do res:res+exp, return(res)))
else apply(nounify(dsum),[exp,var,N])$

(%i2) texput(nounify(dsum),
lambda([arglist], block([e,v,pm],[e,v,pm]:args(arglist),
concat("\\sum_{",tex1(v) ,"|",tex1(pm),"}",tex1(e)))))$

(%i3) texput(moebius, "\\mu")$

(%i4) "A couple of examples of dsum()"$

(%i5) 'divisors(36)=divisors(36);


(%i6) 'dsum(d,d,36)=dsum(d,d,36);


(%i7) 'divisors(20)=divisors(20);


(%i8) 'dsum(f(d),d,20)=dsum(f(d),d,20);


(%i9) exp1:sum(f(n)/n^s,n,1,inf)*sum(g(n)/n^s,n,1,inf)=sum(dsum(f(d)*g(n/d),d,n)/n^s,n,1,inf);


(%i10)