tailieunhanh - A textbook of Computer Based Numerical and Statiscal Techniques part 62
A textbook of Computer Based Numerical and Statiscal Techniques part 62. By joining statistical analysis with computer-based numerical methods, this book bridges the gap between theory and practice with software-based examples, flow charts, and applications. Designed for engineering students as well as practicing engineers and scientists, the book has numerous examples with in-text solutions. | 596 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES ALGORITHM FOR LAGRANGE S INTERPOLATION METHOD Step 1. Start of the program to interpolate the given data Step 2. Input the number of terms n Step 3. Input the array ax and ay Step 4. For i 0 i n i Step 5. nr 1 Step 6. dr 1 Step 7. for j 0 j n j Step 8. if j 1 a nr nr x - ax j b dr ax i - ax j Step 9. End loop j Step 10. y nr dr ay i Step 11. end loop i Step 12. print output x y Step 13. End of the program. PROGRAMMING FOR LAGRANGE S INTERPOLATION METHOD include include include include include void main int n int i j float ax 100 float ay 100 float h float p float nr dr float x 0 y 0 clrscr printf enter the no. of term- scanf d n printf enter the value in the form of x- for i 0 i n i COMPUTER PROGRAMMING IN C LANGUAGE 597 printf enter the value of x d i 1 scanf f ax i printf enter the value in the form of y for i 0 i n i printf enter the value of y d i 1 scanf f ay i printf enter the value of x for printf which you want the value of y scanf f x for i 0 i n i nr 1 dr 1 for j 0 j n j if j i nr nr x-ax j dr dr ax i -ax j y y nr dr ay i printf when x y x y printf press enter to exit getch OUTPUT Enter the no. of term -5 Enter the value in form of x- Enter the value of x1 - 5 Enter the value of x2 - 7 Enter the value of x3 - 11 Enter the value of x4 - 13 Enter the value of x5 - 17 Enter the value in the form of y- Enter the value of y1 - 150 598 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES Enter the value of y2 - 392 Enter the value of y3 - 1452 Enter the value of y4 - 2366 Enter the value of y5 - 5202 Enter the value of x for Which you want the value of y - When x y Press enter to exit. ALGORITHM FOR TRAPEZOIDAL RULE Step 1. Start of the program for numerical integration Step 2. Input the upper and lower limits a and b Step 3. Obtain the number of subinterval by h b-a n Step 4. Input the number of subintervals Step 5. sum 0
đang nạp các trang xem trước