/* A Program to compute Derivatives using Bessel's Formula*/ /*Its a executeable file just paste this code in turbo c and run*/ #include #include #include void main () { int n; float x[10],h,xp,x0,y[10],p,fp1D,fp2D,sf1,sf2,sf3,sf4,sf5,sf6,sf7, sf8,sf1e2,sf2e2,sf1e3,sf1e4,sf3e2,sf2e3,sf4e2,sf4e4, sf3e3,sf2e4,sf5e2,sf4e3,sf3e4,sf6e2,sf5e3; /* Here fp1D & fp2D denotes the 1st & 2nd derivatives of fp at a given point*/ /* s represents here delta*/ /* sf 2,3,4,5,6,7,8 represents the differences of y i.e., y1-y0,y2-y1 etc. */ /* sf1e2 means 1st value of delta square in the table, similarly sf3e2 means 3rd value of delta square in the table. */ /* similarly sf1e3,sf2e3 means 1st & 2nd value of delta cube in the table. */ clrscr(); cout<<"***** A Program to Compute Derivatives using Bessel's Formula *****\n"; delay (5000); clrscr(); cout<<" Muhammad Ali Javed \n\n"; delay (5000); cout<<" 040267 \n"; delay (5000); clrscr(); cout<<" NOTE \n\n"; cout<<"Here fp1D & fp2D denotes the 1st & 2nd derivatives of fp at a given poiny\n\n"; cout<<"s represents here delta\n\n"; cout<<"sf 2,3,4,5,6,7,8 represents the differences of y i.e., y1-y0,y2-y1 etc.\n\n"; cout<<"sf1e2 means 1st value of delta square in the table, similarly sf3e2 means\ 3rd value of delta square in the table. \n\n"; cout<<"similarly sf1e3,sf2e3 means 1st & 2nd value of delta cube in the table.\n\n"; cout<<"Press Enter to continue\n"; getch(); start: clrscr(); cout<<"Enter the value of n between 4 and 8."; cout<<"\n n = "; cin>>n; if (n<4||n>8) { cout<<"Invalid entry, try again."; getch(); goto start; } else { for (int i=0;i!=n;i++) { cout<<"\n Enter x"<>x[i]; cout<<"\n Enter y("<>y[i]; h=x[1]-x[0]; } if (n==4) { sf1=y[1]-y[0]; cout<<"sf1=\t"<>xp; if (xp>x[1]&&xpx[2]) { goto start; } } if (n==5) { sf1=y[1]-y[0]; cout<<"sf1=\t"<>xp; if (xp>x[1]&&xpx[2]&&xpx[3]) { goto start; } } if (n==6) { sf1=y[1]-y[0]; cout<<"sf1=\t"<>xp; if (xp>x[2]&&xpx[3]&&xpx[4]) { goto start; } } if (n==7) { sf1=y[1]-y[0]; cout<<"sf1=\t"<>xp; if (xp>x[2]&&xpx[3]&&xpx[4]) { goto start; } } if (n==8) { sf1=y[1]-y[0]; cout<<"sf1=\t"<>xp; if (xp>x[3]&&xpx[4]&&xpx[5]) { goto start; } } getch(); } }