1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
import java.util.Random;
import java.text.DecimalFormat;
public class simul {
public static void main(String[] args)
{
Random generator = new Random();
int compteur=0, n=10000;
double a, b, moylogb, moyenne, MV, MM, tetha, x, y;
DecimalFormat fmt = new DecimalFormat ("0.#########");
for (int valeur1 = 0; valeur1 <= 9; valeur1++)
{
for (tetha=1; tetha<=1000; tetha++)
{
tetha=tetha/10;
double sum=0, logb=0;
for (int valeur = 1; valeur <= n; valeur++)
{
a = generator.nextDouble();
b = Math.pow(a, 1/(tetha+1));
sum += b;
logb += Math.log(b);
}
moyenne = sum/n;
moylogb = logb/n;
MM = ((2*moyenne)-1)/(1-moyenne);
MV = (-1-moylogb)/moylogb;
x = Math.pow(MM-tetha, 2);
y = Math.pow(MV-tetha, 2);
//System.out.println("tetha "+ tetha + "\t");
//System.out.println ("Le Moment est " + fmt.format(MM));
//System.out.println ("Vraisemblance est " + fmt.format(MV)+ "\n");
//System.out.println ("x est égale " + fmt.format(x));
//System.out.println ("y est égale " + fmt.format(y)+ "\n");
tetha=tetha*10;
}
}
}
} |
Partager