/*
* File: CKMTestRevised.java / by Guowu Meng, April 11, 2013
* --------------------
* This program computes |Vcb| and |Vtd| and via formula (4) in the paper titled "5th force and quark mixing".
*/
import java.math.BigDecimal;
import acm.program.*;
import acm.util.RandomGenerator;
public class CKMTestRevised extends ConsoleProgram {
// input data from http://pdg.lbl.gov/2012/reviews/rpp2012-rev-ckm-matrix.pdf
private static final double //average
v11 = 0.97425, //Vud
v12 = 0.2252, //Vus
s13 = 0.00415, //the magnitude for Vub
d13 = 1.20, //the delta angle
v21 = -0.230, //Vcd
v22 = 1.006, //Vcs
ratio = 0.221; // the ratio |Vtd|/|Vts|
private static final double //standard deviation
b11 =0.00022, //Vud
b12 = 0.0009, //Vus
bs13 = 0.00049, //Vub
bd13 = 0.08, //the delta angle
b21 = 0.011, //Vcd
b22 = 0.023,//Vcs
bratio = 0.007; //the ratio |Vtd|/|Vts|
//private instance variables
private RandomGenerator rgen = RandomGenerator.getInstance();//random generator
private double V12, V22, V21, V11, Ratio;
private double normAve23, normAve31, normStd23, normStd31;
private Complex V13 = new Complex();
// run the tests and display the results
public void run() {
while(true){
int testN = readInt("Please enter the sample size: ");
println("This test is based on CKM and are done for a random gaussian sample of size " + testN+".");
println();
computeAVE(testN); // compute the average of |Vtb|, |Vcb| and |Vtd|
computeSTD(testN); // compute the standard deviation of |Vtb|, |Vcb| and |Vtd|
output(); // display the results
println("End of the tests.");
println();
}
}
// compute the average of |Vtb|, |Vcb| and |Vtd|
private void computeAVE(int testN){
double normSum23 =0, normSum31 =0;
long j = 0;
while(j < testN){
RandomData();//taking a sample
normSum23 +=VV23();
normSum31 += VV31();
j++;
}
normAve23 = normSum23/testN; // the average of |Vcb|
normAve31 = normSum31/testN; // the average of |Vtd|
}
// compute the standard deviation of |Vtb|, |Vcb| and |Vtd|
private void computeSTD(int testN){
double normSq31 = 0, normSq23 =0;
long j = 0;
while(j < testN){
RandomData(); //taking a sample
normSq23 += Math.pow(VV23() -normAve23, 2);
normSq31 += Math.pow(VV31() -normAve31, 2);
j++;
}
normStd23 = Math.sqrt(normSq23/testN); // the std Dev of |Vcb|
normStd31 = Math.sqrt(normSq31/testN); // the std Dev of |Vtd|
}
//Gaussian data sample
private void RandomData(){
double re = GaussianRandom(s13, bs13)*Math.cos(GaussianRandom(d13, bd13));
double im = - GaussianRandom(s13, bs13)*Math.sin(GaussianRandom(d13, bd13));
V11 = GaussianRandom(v11, b11); V12 = GaussianRandom(v12, b12); V13 = new Complex(re, im);
V21 = GaussianRandom(v21, b21); V22 = GaussianRandom(v22, b22);
Ratio = GaussianRandom(ratio, bratio);
}
//formulae for |Vcb|
private double VV23(){
double x = -(V11*V21+V12*V22);
Complex c = new Complex(x,0);
c = c.div(V13.getConjugate());
return c.getNorm();
}
//formulae for |Vtb|
private double VV31(){
double x = Math.sqrt(Math.abs(V11*V12+V21*V22)*Ratio);
return x;
}
//print out the results
private void output(){
println("The norm of Vcb is " + String.format("%8s", Round(normAve23)) + " \u00B1 " + String.format("%8s", Round(normStd23)));
println("The norm of Vtd is " + String.format("%8s", Round(normAve31)) + " \u00B1 " + String.format("%8s", Round(normStd31)));
println();
}
//round up a double to 7 decimal place
private double Round(double r){
int decimalPlace = 7;
BigDecimal bd = new BigDecimal(r);
bd = bd.setScale(decimalPlace,BigDecimal.ROUND_UP);
return bd.doubleValue();
}
//taking a Gaussian random number in a normal distribution with average ave and standard deviation std
private double GaussianRandom(double ave, double std){
double r = rgen.nextGaussian() * std + ave;
return r;
}
}