// E04: constant-potential toy operator (V=0.75), deliberately NOT V(x)=x*x/2.
#include <array>
#include <cmath>
#include <iostream>
int main() {
    constexpr double h=1.0, constant_potential=0.75;
    constexpr int n=4;
    std::array<double,n> d{},v{{1,2,3,4}},y{},expected{{.75,1.5,2.25,5.5}};
    std::array<double,n-1> e{};
    for (double &a:d) a=1/(h*h)+constant_potential;
    for (double &a:e) a=-1/(2*h*h);
    for (int i=0;i<n;++i) {
        y[i]=d[i]*v[i];
        if (i) y[i]+=e[i-1]*v[i-1];
        if (i+1<n) y[i]+=e[i]*v[i+1];
        if (std::abs(y[i]-expected[i])>1e-13) return 1;
    }
    std::cout << "d=" << d[0] << " e=" << e[0] << " Tv=";
    for (double t:y) std::cout << ' ' << t;
    std::cout << "\nPASS E04\n";
}
