English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

/* e(x) = 1 + x + x2 / 2! + x3 / 3! + x4/ 4! --------- xn / n! */

ender x number 1
endre n number 2
out put 1.176000
pls correct it math
what type of math this pls tall me

#include
#include
#include
void main()
{
int fact();
float x, t, sum;
int i, n;
printf("\n Enter the Value of x & n:");
scanf("%f %d", &x, &n);
x = x * 3.14/180;
t = 1;
sum = 1;
for ( i = 1; i <= n; i++)
{
t = t * pow(x, i) / fact(i);
sum = sum + t;
}
printf("\n The Value of ex = %f \n", sum);
}
int fact( int n)
{
int i;
for ( i = 1; i <= n; i++)
fact *= i;
return fact;
}

2007-06-29 21:26:19 · 3 answers · asked by robin j 1 in Science & Mathematics Mathematics

3 answers

its a taylor series expansion of e^x, the series should converge quickly because the further you go out, the factorial will be larger than your power. You can check your answer by just pluging in e^1 = 2.7183... Look on a scientific calculator for e^x

2007-06-29 22:38:37 · answer #1 · answered by John 5 · 0 0

Why are you trying to convert to radians? For this problem, x should be used as entered.
Where is pow(x,i) defined? Is it a standard function included in your libraries?

2007-06-30 04:49:01 · answer #2 · answered by Helmut 7 · 0 1

http://fermatslasttheorem.blogspot.com/2006/02/eulers-formula.html

2007-06-30 04:39:17 · answer #3 · answered by SinfulAngel 1 · 0 2

fedest.com, questions and answers