Calculating Area Under Curve with Trapezium Rule

Click For Summary
SUMMARY

The discussion focuses on implementing a modified trapezium rule for calculating the integral of the function \(\int \frac{1}{x} dx\) from 1 to 101. The method involves using strips of varying widths, defined by the formula \(\Delta X_n = r^{n-1} \Delta X_1\), where \(r\) is a constant input. The challenge is to determine \(\Delta X_1\) to ensure a total of 100 strips, leveraging the geometric progression formula. Participants suggest using MATLAB's trapz function for numerical integration, although access to MATLAB is a limitation for some users.

PREREQUISITES
  • Understanding of numerical integration techniques, specifically the trapezium rule.
  • Familiarity with geometric progressions and their summation formulas.
  • Basic programming skills in MATLAB or similar numerical computing environments.
  • Knowledge of vector operations and functions in MATLAB.
NEXT STEPS
  • Implement the trapezium rule in MATLAB using the defined strip widths.
  • Research the geometric progression formula to calculate \(\Delta X_1\) accurately.
  • Explore MATLAB's trapz function for efficient numerical integration.
  • Investigate alternative numerical integration methods for comparison, such as Simpson's rule.
USEFUL FOR

Students, educators, and professionals in mathematics or engineering fields who are interested in numerical methods for integration, particularly those using MATLAB for computational tasks.

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

[tex]\int1/x dx[/tex] between 1 and 101

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

[tex]\Delta[/tex]Xn=rn-1[tex]\Delta[/tex]X1 where [tex]\Delta[/tex]Xn 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?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
2
Views
1K
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K