Fortran Programs: Implementing Numerical Methods for Calculus Problems
VerifiedAdded on 2022/12/23
|6
|1119
|84
Homework Assignment
AI Summary
This assignment presents two Fortran programs. The first program calculates the derivative of sin(x) at x=1 using a finite-difference method, varying the number of grid points to demonstrate the impact on accuracy. The second program implements Simpson's 1/3 and 3/8 rules to numerically evaluate the integral of x^n * e^(x-1) from 0 to 1, where 'n' is an integer input by the user. The code includes a recursive function for calculating a factorial and demonstrates the application of numerical integration techniques. The program calculates and compares the results from the analytical solution (factorial) and Simpson's rule, along with the relative error, providing a practical demonstration of numerical methods in Fortran.
1 out of 6







