- #1
Chris Red
- 1
- 0
Thread moved from a technical section, so is missing the homework template
I have a question set for programming to compute integral for the following unknown function using composite rectangle method, trapezoidal rule and simpsons rule.
[tex]\int_{0}^{1.8} f(x) dx[/tex]
for h=0.3 and h=0.4
I have a table of results for f(x) and x as follows
x=0, 0.3, 0.6, 0.9, 0.12, 0.15, 0.18
f(x)=0.5, 0.6, 0.8, 1.3, 2, 3.2, 4.8
My interval is 6 using the formula n=1.8-0/0.3 for the first case. I am just wondering how I should approach this problem in my programming.
For the rectangle method does anyone have a step by step guide of how this would be done analytically. Surely this would also require the user to enter all values for f(x) too or they be read from a file in some way? I am mainly struggling because I am not sure how to implement this into my program which is in FORTRAN. I have not even thought about how to tackle the trapezoidal or simpson rule yet! Ideally they should be all within one program where the user selects the method of approximation.
Thanks for any advice
[tex]\int_{0}^{1.8} f(x) dx[/tex]
for h=0.3 and h=0.4
I have a table of results for f(x) and x as follows
x=0, 0.3, 0.6, 0.9, 0.12, 0.15, 0.18
f(x)=0.5, 0.6, 0.8, 1.3, 2, 3.2, 4.8
My interval is 6 using the formula n=1.8-0/0.3 for the first case. I am just wondering how I should approach this problem in my programming.
For the rectangle method does anyone have a step by step guide of how this would be done analytically. Surely this would also require the user to enter all values for f(x) too or they be read from a file in some way? I am mainly struggling because I am not sure how to implement this into my program which is in FORTRAN. I have not even thought about how to tackle the trapezoidal or simpson rule yet! Ideally they should be all within one program where the user selects the method of approximation.
Thanks for any advice