Mathc complexes/a151
Installer et compiler ce fichier dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
nb_Z acos_Z(
nb_Z A
)
{
nb_Z A_n;
nb_Z sA;
nb_Z sinA = i_Z(0,0);
nb_Z PIt = i_Z(3.14159265359/2., 0.);
int n = 10;
int i;
for(i=0.; i <= n; i++)
{
A_n = pow_Z((2.*i+1.), A);
sA = smul_Z( factorial(2.*i)
/
(pow(4.,i)*pow(factorial(i),2.)*(2.*i+1.)),
A_n);
sinA = add_Z(sinA,sA);
}
sinA = sub_Z(PIt,sinA);
return (sinA);
}
/* ------------------------------------ */
int main(void)
{
nb_Z a = i_Z(-.98112545,.02453546);
nb_Z b = cos_Z(a);
clrscrn();
printf(" cos(");
p_Z(a,S3,P8,S3,P8);
printf(") = ");
p_Z(cos_Z(a),S3,P8,S3,P8);
printf("\n\n\n");
printf(" acos(");
p_Z(b,S3,P8,S3,P8);
printf(") = ");
p_Z(acos_Z(b),S3,P8,S3,P8);
printf("\n\n\n");
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Cet exemple pose des problèmes. Je l'ai installé pour mémoire.
Exemple de sortie écran :
cos(-0.98112545+0.02453546i ) = +0.55625490+0.02039405i
acos(+0.55625490+0.02039405i ) = +0.98112783-0.02453392i
Press return to continue.
# --------------------------------
# Copy/Past into the octave window
#
x = cos(-0.98112545+0.02453546i )
y = acos(+0.55625490+0.02039405i )
#