001package cli;
002
003import kernels.EnergyDensityKernel;
004import models.*;
005
006import org.apache.commons.math3.complex.Complex;
007
008/**
009 * (For Fig 3b) Computes the lowest eigenvalue of the smeared energy density,
010 * for a model with S-matrix consisting of \(n\) pairs of sinh-Gordon factors 
011 * with complex coupling constant, \(B=1\pm k a i\), where \(k=1..n\),
012 * and \(a>0\) is a constant. \(n\) is varied over a certain range.
013 * 
014 * Takes four command line arguments: the number \(N\) of discretization steps,
015 * the rapidity cutoff \(R\), the maximum number of S-matrix factors pairs (\(n\)
016 * is varied from 1 to this value), and the step size in the coupling, \(a\). 
017 */
018public class ComplexCouplingsAnalyzer extends CLIAnalyzer {
019
020    private static double lowestEv(IntegrableModel model, int coshPower, int n,
021            double cutoff) {
022        EnergyDensityKernel k = new EnergyDensityKernel(model, 1.0, 0.0,
023                coshPower, 0.1);
024        double ev = k.findLowestEigenvalue(n, cutoff);
025        return ev;
026    }
027
028    public static void main(String[] args) {
029
030        int N = Integer.parseInt(args[0]);
031        double R = Double.parseDouble(args[1]);
032        int couplingsMax = Integer.parseInt(args[2]);
033        double a = Double.parseDouble(args[3]);
034
035        String header = "Product model by number of complex-conjugate factors, N="+ N + ", R="+ R
036                + ", up to " + couplingsMax + " factors in steps of " + a;
037        System.out.println(header);
038
039        double[][] res = new double[couplingsMax][2];
040
041        for (int factors = 1; factors <= couplingsMax; factors++) {
042
043            Object[] b = new Object[factors];
044            for (int i = 0; i < factors; i++) {
045                b[i] = new Complex(1.0, (i+1) * a);
046            }
047
048            IntegrableModel model = new ProductModel(b);
049
050            res[factors - 1][0] = factors;
051            res[factors - 1][1] = lowestEv(model, factors, N, R);
052        }
053
054        writeDatafile("ComplexCouplings", header, res);
055    }
056}