001package cli;
002
003import kernels.EnergyDensityKernel;
004import models.*;
005
006import org.apache.commons.math3.linear.RealVector;
007
008/**
009 * (For Fig 1) Computes the lowest eigenvector of the smeared energy density, 
010 * for the Ising model and the sinh-Gordon model (coupling \(B=1\)).
011 * 
012 *  Takes two command line arguments: the number of discretization steps, \(N\), and the cutoff radius, \(R\).
013 */
014public class EigenvectorAnalyzer extends CLIAnalyzer {   
015    
016    public static void main(String[] args) {
017        int N = Integer.parseInt(args[0]);
018        double R = Double.parseDouble(args[1]);
019        
020        String header = "Ising and sinh-Gordon models, Energy density lowest eigenvector, N="+N+", R="+R;
021        System.out.println(header);
022        
023        double[][] res = new double[N][3];
024
025        IntegrableModel model;
026        EnergyDensityKernel k;
027        
028        model = new IsingModel();
029        k = new EnergyDensityKernel(model, 1.0, 0.0, 0, 0.1);
030        RealVector isingV = k.findLowestEigenvector(N, R);
031        
032        model = new SinhGordonModel(1.0);
033        k = new EnergyDensityKernel(model, 1.0, 0.0, 0, 0.1);
034        RealVector sinhV = k.findLowestEigenvector(N, R);
035        
036        // amplitude of the orthonormal step functions 
037        double amplitude = Math.pow(2*R/N, -0.5);
038        for (int i = 0; i < N; i++) {
039                res[i][0] = -R+(2*R/N)*(i+0.5);
040            res[i][1] = isingV.getEntry(i) * amplitude;
041            res[i][2] = sinhV.getEntry(i) * amplitude;;
042        }
043        
044        writeDatafile("Eigenvector", header, res);
045    }
046}