TAYLOR SERIES
The Taylor series of a real or complex-valued function ƒ(x) that is infinitely differentiable in a neighborhood of a real or complex number a is the power series
-
- THE PROGRAM :
- #include<stdio.h>
#include<math.h>
#include<float.h>
#include<conio.h>
void main()
{
double x=0.5,e=1.0,term=1.0,fact=1.0;
int i;
for(i=1;term>=FLT_EPSILON;i++)
{
fact=fact*i;
term=pow(x,i)/fact;
e=e+term;
}
printf("\n Sum without using library function exp(%lf) = %lf \n",x,e);
printf("\n Sum using library function exp(%lf) = %lf \n",x,exp(x));
getch();
} - Just copy and paste into your Microsoft Visual C++ or Turbo C (these are program developing software)Or else you can try this demo file and use it ...
Click HERE to download this file.
(Press ctrl+z and hit Enter to end the program)..
~NOTE~ : While executing if you get any warning then just ignore it and continue with your program... - IF FACE ANY PROBLEM DON'T FORGET TO COMMENT ...!!
No comments:
Post a Comment