Problem with Combining Simpson's 1/3 and 3/8 Rule(Matlab)

  • Thread starter jdawg
  • Start date
In summary, the conversation discusses the process of evaluating the integral of sin^3(x) from 1 to 6, with one person mentioning that they guessed the bounds split at 3 and wondering if there is a formula to calculate the bounds. The other person mentions knowing the cardinal values of the sine function and points out that x=3 is only an approximation.
  • #1
jdawg
367
2

Homework Statement


∫ sin^3(x) dx evaluated from 1 to 6
I'm pretty what I have is correct, but I got the answer by guessing that the bounds split at 3.
Is there a formula to calculate where the bounds break?

Homework Equations

The Attempt at a Solution


function I = simpson13(func, a, b, n)
function I = simpson38(func, a, b, n)
% input:
% func= name of function to be integrated
% a,b = integration limits
% n = number of segments (default = 100)
% Output:
% I = integral estimate

A = @(x) sin(x)^3
% simpsons rule n = 5
% from 1 to 6
simpson13(A,1,3,2)+simpson38(A,3,6,3)
 
Physics news on Phys.org
  • #2
jdawg said:

Homework Statement


∫ sin^3(x) dx evaluated from 1 to 6
I'm pretty what I have is correct, but I got the answer by guessing that the bounds split at 3.
Is there a formula to calculate where the bounds break?
Yeah, it's called knowing the cardinal values of the sine function.

BTW, x = 3 is only an approximation. What is sine (π)?
 

Related to Problem with Combining Simpson's 1/3 and 3/8 Rule(Matlab)

1. What is Simpson's 1/3 and 3/8 Rule and how do they differ?

Simpson's 1/3 rule and 3/8 rule are both methods for approximating the area under a curve. The main difference between them is the number of data points used to create the approximating polynomial. Simpson's 1/3 rule uses three data points while Simpson's 3/8 rule uses four data points.

2. When should Simpson's 1/3 and 3/8 Rule be used?

Simpson's 1/3 rule and 3/8 rule are typically used when the function being integrated is smooth and continuous. They can also be used for non-smooth functions, but the accuracy may be reduced.

3. Can Simpson's 1/3 and 3/8 Rule be combined?

Yes, Simpson's 1/3 rule and 3/8 rule can be combined in certain cases. This is known as Simpson's 3/8 rule with an extended interval. It involves using Simpson's 3/8 rule on the first and last intervals, and then using Simpson's 1/3 rule for the remaining intervals.

4. What are the limitations of combining Simpson's 1/3 and 3/8 Rule?

Combining Simpson's 1/3 and 3/8 rule can lead to a loss of accuracy, especially when the function being integrated is not smooth. It is also important to note that this combination should only be used when the number of intervals is divisible by three.

5. How can I implement the combination of Simpson's 1/3 and 3/8 Rule in Matlab?

To implement Simpson's 3/8 rule with an extended interval in Matlab, you can use the built-in function "quad" with the option "Simpson's 3/8". This will automatically use Simpson's 3/8 rule for the first and last intervals, and Simpson's 1/3 rule for the remaining intervals. Alternatively, you can manually implement the combination by dividing the integration interval into three subintervals and applying Simpson's 3/8 rule on the first and last subintervals, and Simpson's 1/3 rule on the remaining subintervals.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
3
Views
866
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
17K
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
Back
Top