Posts

Showing posts from April, 2013

Integration by Parts

Image
When find the solution through the Simpson rule for " I" we must have to choose the step size neither small nor large to get the accurate answer. It means we have to limit the number of sub segments for the higher accuracy. If we select large number of sub segments it should affect to increase the round off error, and if we choose small number of sub segments we can’t get exact solution. There I used multiple segments Simpson 1/3 rule and Simpson 3/8 rule to solve above equation. Because Simpson 1/3 only works for even number of segments and Simpson 3/8 works for multiplication of 3 segments. Multiple segments Simpson 1/3 rule Multiple segments Simpson 3/8 rule According to my program user can select the number of segments (n) as they want. When we apply a = 0, b = 1, assume n = 50 segments, h = (1-0 )/50 we can do the calculation in below progress. Here is the result from Simpson 1/3 rule.    When above constant values apply to Simpson 3/8 rule we c...

Integration of cos(x)

Image
We can find analytical value as below, The solution from the " I"  in above range through the Simpson rule we can get 0.00000 as an approximation value. There we can’t calculate the absolute relative true error. Because the actual value of the integration of cos(x) from 0 to 180 degrees it gets zero. If we will find absolute relative approximation error there should be happened division by zero. The most optimum value of the “h” should be an average value such as “0.01”. It means we should select average number of segments as 48 or 54. Because if we select very large h it decreases the number of segments. As a result we can’t get accurate value. And if we select very small “h” it increases the number of segments. But it should affect to increase the round-off error. That is the reason for we must have to select average value of number of segments to get “h”. Implementation in FORTRAN 1.)Do the compilation as below.     gfortran -ffree-form s...