Calculating Area Under Curve with Trapezium Rule

AI Thread Summary
The discussion focuses on using a modified trapezium rule to calculate the integral of 1/x from 1 to 101, emphasizing the need for varying strip widths to enhance accuracy. Participants suggest defining a vector for x and calculating y values, but there is uncertainty about implementing the trapezium rule without MATLAB access. The problem requires determining the initial strip width, Δx1, to ensure a total of 100 strips based on a geometric progression. The conversation highlights the challenge of starting the solution and seeks guidance on the approach. Overall, the thread revolves around finding an effective method to apply the trapezium rule with geometric strip widths.
henryc09
Messages
68
Reaction score
0

Homework Statement


A modified form of the trapezium rule for calculating the area under a curve makes use of strips
of varying width: by using narrower strips where the gradient varies more rapidly, better
accuracy can be achieved. Create a function to perform the integral

\int1/x dx between 1 and 101

using the trapezium rule with strips that increase geometrically in width, such that,

\DeltaXn=rn-1\DeltaX1 where \DeltaXn is the width of the nth strip and r is a constant (which is an
input to the function).
Choose the value of Δx1 to give a total of 100 strips for any value of r (hint: you will need the
formula for the sum of a geometric progression to calculate Δx1).

Homework Equations


b00394bd694cf4efdc248ce10ba6d29b.png

The Attempt at a Solution



Not sure where to start really, I mean a simple application of the trapezium rule to it would be simple enough. Define a vector x=[1:1:101] and then y=1./x and integral=trapz(x,y) or something along those lines (I don't have access to MATLAB from home so I couldn't be sure). Any point in the right direction would be much appreciated.
 
Last edited:
Physics news on Phys.org
Did you ever find an answer to this question?
 
Back
Top