Feb 27, 2010

Product over primes

It is possible in Maxima to define pproduct which is the product over primes, similar to ordinary product(). Because I want the evaluation rule of the arguments of pproduct to be the same as product, I used buildq.


Also, the texput is used to define the output of TeX so that it can be rendered as expected in Imaxima. You can obtain the file pproduct.mac from here.


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) pproduct(e, var, pmax) ::=
if integerp(pmax)
then buildq([e:e,v:var,pm:pmax], block([res:1],for v:next_prime(1) while (v else apply(nounify(pproduct),[e,var,pmax])$

(%i2) texput(nounify(pproduct),
lambda([arglist], block([e,v,pm],[e,v,pm]:args(arglist),
if (pm=inf) then
concat("\\prod_{",tex1(v) ,":prime}",tex1(e))
else
concat("\\prod_{",tex1(v) ,":prime <",tex1(pm),"}",tex1(e)))))$


The function pproduct can be used to write down the famous Euler product of the Riemann zeta function.


(%i3) zeta(s)=pproduct(1/(1-p^(-s)),p,inf);


(%i4) subst(10,inf,rhs(%));


(%i5) ev(%,nouns);


(%i6)

Feb 20, 2010

Value of zeta(2)

Here shows that


using the sine factorization formula. The session file can be obtained from here.


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/test-imaxima/cmucl/5.20.0/share/maxima/5.20.0/emacs/imaxima.lisp")), linenum:0)$

(%i1) powerdisp:true;


(%i2) sin(%pi*x)=%pi*x*product(1-x^2/n^2,n,1,inf);


(%i3) sin(%pi*x)=taylor(sin(%pi*x),x,0,10);


(%i4) coeff(rhs(%),x,3);

We see how the first n terms of the infinite product is expanded with n=2,3,4,5,6, and 10 and seet the coincidence of coeffcients of x^3 to the sum of first n terms of the infinite sum definition of zeta function.


(%i5) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=2;


(%i6) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=2;


(%i7) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=3;


(%i8) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=3;


(%i9) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=4;


(%i10) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=4;


(%i11) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=5;


(%i12) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=5;


(%i13) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=6;


(%i14) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=6;


(%i15) %pi*x*'product(1-x^2/n^2,n,1,k)=expand(%pi*x*product(1-x^2/n^2,n,1,k)),k=10;


(%i16) 'sum(1/n^2,n,1,k)=sum(1/n^2,n,1,k),k=10;


Thus the following equation holds:


(%i17) -sum(1/n^2,n,1,inf)*%pi=-%pi^3/6;


(%i18) %/(-%pi);


(%i19)