BigInteger cos1, fact, dln, prec;
int n;
int precision = 620;
prec = BigInteger.Pow(10, precision);
cos1 = prec;
n = 3;
fact = 2;
dln = BigInteger.Divide(prec, fact);
while ((BigInteger.Compare(dln, 1)) >= 1)
{
dln = BigInteger.Divide(prec, fact);
cos1 = BigInteger.Subtract(cos1, dln);
fact = BigInteger.Multiply(fact, n * (n + 1));
n = n + 2;
dln = BigInteger.Divide(prec, fact);
cos1=BigInteger.Add(cos1, dln);
fact = BigInteger.Multiply(fact, n * (n + 1));
n = n + 2;
}
textBox2.Text = cos1.ToString();
textBox2.Refresh();for (n=1;n<=2017; n++)
{
// calcul de U<- 2U²-1 pour avoir cos(x) <- cos(2x)
// tous les chiffres sont multipliés par 10^650
fact = BigInteger.Pow(fact, 2); //U²
fact = BigInteger.Divide(fact, BigInteger.Pow(10, precision));
// rétablissement de la bonne position de la virgule
fact = BigInteger.Multiply(fact, 2);//2U²
fact = BigInteger.Subtract(fact, BigInteger.Pow(10, precision));//2U²-1
}
textBox1.Text = fact.ToString();Non, j'ai fait le calcul par les 2 méthodes (avec l'approximation de Pi et aussi calcul avec la formule d'Euler) ont trouve la même chose, bon bref je m'étais fait la même remarque, mais pourtant cela donne la bonne solution, fais le calcul si tu ne me crois pas (les |u_j| sont en moyennes de la taille 1/2, ceci expliquerais cela)[*]
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 7 invités
Tu pars déja ?
Identification
Pas encore inscrit ?
Ou identifiez-vous :