#Feb. 15, 2018, ExpMath(RU), C9.txt Help:=proc():print(` Th(t,N), CheckJac(t,N) , Thf(t,N), CheckTay(p,x), RaTP(x,N) , FS(f,x,N), FSn(f,x,N), FSn(f,x,N,x0) `): end: #Th(t,N): The truncated Jacobi theta function Th:=proc(t,N) local n: evalf(add(exp(-Pi*n^2*t),n=-N..N)): end: CheckJac:=proc(t,N) evalf(Th(t,N)*sqrt(t)/Th(1/t,N)): end: #Thf(t,N): a faster way for small t Thf:=proc(t,N) if t>=1 then Th(t,N) else Th(1/t,N)/sqrt(t): fi: end: #Checks Taylor for a polynomail p of x CheckTay:=proc(p,x) local i: p-subs(x=0,p)- add( subs(x=0,diff(p,x$i))/i!*x^i,i=1..degree(p,x)): end: #RaTP(x,N): a random trig. polynomial of period 1 of degree N #with integer coefficients <=1000 RaTP:=proc(x,N) local ra,n: ra:=rand(1..1000): add(ra()*exp(2*Pi*I*n*x),n=-N..N): end: #FS(f,x,N): The Fourier series of a function f of x on [0,1], truncated to N FS:=proc(f,x,N) local n: add(int(exp(-2*Pi*I*n*x)*f,x=0..1)*exp(2*Pi*I*n*x),n=-N..N): end: #FSn(f,x,N,x0): The Fourier series of a function f of x on [0,1], truncated to N,done numerically #modified Feb. 18, 2018 FSn:=proc(f,x,N,x0) local n: add(evalf(Int(exp(-2*Pi*I*n*x)*f,x=0..1))*evalf(exp(2*Pi*I*n*x0)),n=-N..N): end: