(*

This code is written by Antun Balaz (antun@ipb.ac.rs) and Ivana Vidanovic (ivanavi@ipb.ac.rs) from the Scientific Computing Laboratory of the Institute of Physics Belgrade, http://www.scl.rs/

The code calculates velocity-independent part of a single-particle one-dimensional effective potential W[x, xbar; eps] to level eps^(p-1) for time independent potential V[x]. The use of level p effective potential for calculation of short-time amplitudes leads to substantially reduces errors, proportional to eps^(p+1-Pd/2), where P is the number of particles, and d is spatial dimensionality. For the case P=d=1 considered in this file, the errors are proportional to eps^(p+1/2). In Path-Integral Monte Carlo calculations of transition amplitudes, the error is proportional to 1/N^p, where N is the number of time steps used in the discretization. The effective potential is defined as

W[p, x, eps] = Sum[c[m] eps^m, {m, 0, p - 1}] ,

and the velocity independent part (xbar=0) is obtained for k=0. The coefficients c[m, 0]=c[m] are calculated by iterating the recursion given in Eq. (26) from the paper "Recursive Schroedinger Equation Approach to Faster Converging Path Integrals" by A. Balaz, A. Bogojevic, I. Vidanovic, and A. Pelster, Phys. Rev. E 79, 036701 (2009), available from http://arxiv.org/abs/0806.4774

The diagonal effective actions up to the level p=37 are available in the file EffectiveAction-Diagonal-1d-p37.m from http://www.scl.rs/speedup/

*)

p = 37;
c[_] = 0;
c[0] = V[x];
CurrentTime=FromDate[Date[]];
StartTime=CurrentTime;
For[m = 1, m < p, m++, c[m]=Expand[Integrate[Expand[D[c[m-1], {x,3}] / 4 - 2 V[x]D[c[m-1], {x, 1}] + 
2 Sum[D[c[k],{x, 1}] c[m-k-1], {k, 0, m-1}] + 2 Sum[k c[k] D[c[m-k-1], {x, 1}], {k, 1, m-1}] - 3 Sum[D[c[k], {x, 1}] D[c[m-k-2], {x, 2}], {k,0,m-2}] / 4 +Sum[D[c[k], {x, 1}] D[c[l], {x, 1}] D[c[m-k-l-3], {x, 1}],{k, 0, m-3}, {l, 0,m-k-3}] / 4]/(2 m+1), x]];
  Print["p = ",m+1," contribution calculated."]; CalculationEndTime=FromDate[Date[]]; CalculationTime=CalculationEndTime-StartTime; Print["Calculation time = ",CalculationTime," seconds."]; Print["Memory used: ",N[MaxMemoryUsed[]/1024/1024]," MB"]; Print[]]

(* To save the output of p=37 calculation to a file, the following command was used: *)
Definition[c] >>> "EffectiveAction-Diagonal-1d-p37.m";

(* Level p effective potential. *)
W[p, x_, eps_] = Sum[c[m] eps^m,{m,0,p-1}]