#include "well.h" #include "math.h" const double PI=acos(-1); double well::wav1d(int k, double x) { if (fabs(x)>width) return 0; k++; double wav=x*PI/width/2; if (k%2) wav=cos(k*wav); else wav=sin(k*wav); wav/=sqrt(width); return wav; } double well::secdiv(int k) { k++; return (-k*k*PI*PI/width/width/4.0); } double well::E(int k) { return -secdiv(k)/2/mass; }