Simpson's rule with changing volumes

In summary: st4 = st4 + 4*func(i);endwhile (n... st2 = st2 + 2*func(n);endbuoyancy_force = (density*g)*(h/3*(func(1)+st4+st2+func(i))); disp (buoyancy_force)fprintf('step %.3f\n',i);disp (st4)disp (st2)
  • #1
noelll
13
0
Hi there,

Homework Statement


I am doing a simulation of a free-fall lifeboat trajectory into the ocean and there is a part where i need to get the volume of the lifeboat to obtain its buoyancy force.

Buoyancy force is proportional to the immersed volume of the body and this volume can be obtain by integrating the immersed cross-section area along the length of the boat(I am using Simpson's rule 1/3 for this).

2. Homework Equations

Buoyancy force = Density*gravity*volume

Question i would like to ask, do i need to find the volume in a time-step manner, currently the ideal i have in mind is at each meter of the lifeboat length i will obtain a cross-section and after reaching the end of the lifeboat length which is 8.5 m i add up all the cross-section area? however i do not know how to do it.

The Attempt at a Solution


i tried doing the simpson's rule. But i could only get a single number.
Code:
%INPUTS
L      = 0;   %lower limit
U      = 8.5; % upper limit
n      = 40;  % number of segments
Length = 1;
Breath = 3;
Height = 2.3;
density= 1.025;
g      = 9.81;

func = @(x) (Breath * Height);
h = (U-L)/n;

st4 = 0;
st2 = 0;

for i = 2:h:n
    st4 = st4 + 4*func(i);
end

for i = 3:h:n
    st2 = st2 + 2*func(n);
end

buoyancy_force = (density*g)*(h/3*(func(1)+st4+st2+func(i)));
  
disp (buoyancy_force)
fprintf('step %.3f\n',i);
disp (st4)
disp (st2)

I hope anybody out there could help me, really need your help, thank you so much!
Best Regards,
Noel
 
Last edited:
Physics news on Phys.org
  • #2
noelll said:
Hi there,

Homework Statement


I am doing a simulation of a free-fall lifeboat trajectory into the ocean and there is a part where i need to get the volume of the lifeboat to obtain its buoyancy force.

Buoyancy force is proportional to the immersed volume of the body and this volume can be obtain by integrating the immersed cross-section area along the length of the boat(I am using Simpson's rule 1/3 for this).

2. Homework Equations

Buoyancy force = Density*gravity*volume

Question i would like to ask, do i need to find the volume in a time-step manner, currently the ideal i have in mind is at each meter of the lifeboat length i will obtain a cross-section and after reaching the end of the lifeboat length which is 8.5 m i add up all the cross-section area? however i do not know how to do it.

The Attempt at a Solution


i tried doing the simpson's rule. But i could only get a single number.
Code:
%INPUTS
L      = 0;   %lower limit
U      = 8.5; % upper limit
n      = 40;  % number of segments
Length = 1;
Breath = 3;
Height = 2.3;
density= 1.025;
g      = 9.81;

func = @(x) (Breath * Height);
h = (U-L)/n;

st4 = 0;
st2 = 0;

for i = 2:h:n
    st4 = st4 + 4*func(i);
end

for i = 3:h:n
    st2 = st2 + 2*func(n);
end

buoyancy_force = (density*g)*(h/3*(func(1)+st4+st2+func(i)));
 
disp (buoyancy_force)
fprintf('step %.3f\n',i);
disp (st4)
disp (st2)

I hope anybody out there could help me, really need your help, thank you so much!
Best Regards,
Noel
Well, volume is a single number. You are calculating the area under the curve of cross-sectional areas for the hull of the lifeboat, and this area is numerically equal to the volume.

If the immersed volume of the lifeboat is changing in time, then you'll have to calculate a new volume with each time step, assuming you can determine the shape of the cross sections which compose this volume at the corresponding time.
 
  • #3
SteamKing said:
Well, volume is a single number. You are calculating the area under the curve of cross-sectional areas for the hull of the lifeboat, and this area is numerically equal to the volume.

If the immersed volume of the lifeboat is changing in time, then you'll have to calculate a new volume with each time step, assuming you can determine the shape of the cross sections which compose this volume at the corresponding time.

Hi,
Thank you so much for your reply,
yes the immersed volume of the lifeboat is changing as it enters the water and i would need to evaluate a new volume each sec, when it dives in. However, i tried doing a while loop, and my code just kept running, my knowledge in MATLAB is at beginner's level, but i am keen to learn so i hope you could teach me what to do?

Code:
%INPUTS
L      = 0;   %lower limit
U      = 8.5; % upper limit
n      = 40;  % number of segments
Length = 1;
Breath = 3;
Height = 2.3;
density= 1.025;
g      = 9.81;

func = @(x) (Breath * Height);
h = (U-L)/n;

st4 = 0;
st2 = 0;

while (i < 40)

    for i = 2:h:n
        st4 = st4 + 4*func(i);
    end

    for i = 3:h:n
        st2 = st2 + 2*func(n);
    end

    Buoyancy_Force = (density*g)*(h/3*(func(1)+st4+st2+func(i)));

end
disp (Buoyancy_Force)
fprintf('step %.3f\n',i);
disp (st4)
disp (st2)

The following while loop i used i<40 , the reason why i put that was, i divided the lifeboat into 40 strips and so i was thinking my simpson's rule could evaluate at every i interval till it reached the 40th strip and stop.

Please help!

Thank you!,
Best Regards,
Noel
 

Attachments

  • lifeboat.png
    lifeboat.png
    2.2 KB · Views: 499
  • #4
noelll said:
Hi,
Thank you so much for your reply,
yes the immersed volume of the lifeboat is changing as it enters the water and i would need to evaluate a new volume each sec, when it dives in. However, i tried doing a while loop, and my code just kept running, my knowledge in MATLAB is at beginner's level, but i am keen to learn so i hope you could teach me what to do?

Code:
%INPUTS
L      = 0;   %lower limit
U      = 8.5; % upper limit
n      = 40;  % number of segments
Length = 1;
Breath = 3;
Height = 2.3;
density= 1.025;
g      = 9.81;

func = @(x) (Breath * Height);
h = (U-L)/n;

st4 = 0;
st2 = 0;

while (i < 40)

    for i = 2:h:n
        st4 = st4 + 4*func(i);
    end

    for i = 3:h:n
        st2 = st2 + 2*func(n);
    end

    Buoyancy_Force = (density*g)*(h/3*(func(1)+st4+st2+func(i)));

end
disp (Buoyancy_Force)
fprintf('step %.3f\n',i);
disp (st4)
disp (st2)

The following while loop i used i<40 , the reason why i put that was, i divided the lifeboat into 40 strips and so i was thinking my simpson's rule could evaluate at every i interval till it reached the 40th strip and stop.

Please help!

Thank you!,
Best Regards,
Noel
IDK anything about MATLAB programming, but there seems to be something strange with the structure of your loops.

You calculate h = (U - L)/n, which gives you 0.2125 using the data in your script. It's not clear how MATLAB decodes i = 2:h:n or i = 3:h:n, but if your loop counter is being incremented by 0.2125 each time, that may be a problem. h is a fixed quantity; I'm just not sure what it's doing in a loop counter.
 
  • #5
SteamKing said:
IDK anything about MATLAB programming, but there seems to be something strange with the structure of your loops.

You calculate h = (U - L)/n, which gives you 0.2125 using the data in your script. It's not clear how MATLAB decodes i = 2:h:n or i = 3:h:n, but if your loop counter is being incremented by 0.2125 each time, that may be a problem. h is a fixed quantity; I'm just not sure what it's doing in a loop counter.

Hi!
Thank you for your reply!
Base on my knowledge, i = 2:h:n refers to i starting value 2 will have a increment of h till it reached the value of n .

Is this causing me the problems? What would you suggest me to do instead?

Sorry to trouble you!

Noel
 
  • #6
noelll said:
Hi!
Thank you for your reply!
Base on my knowledge, i = 2:h:n refers to i starting value 2 will have a increment of h till it reached the value of n .

Is this causing me the problems? What would you suggest me to do instead?

Sorry to trouble you!

Noel
Well, IDK if it's causing your problems, but trying to count from 2 to 40 in increments of 0.2125 is a little strange.

I think you need to separate the number of the section of interest (i = 1, 2, 3, ..., 40) from its location from one end of the boat (x = 0, 0.2125, 0.4250, ..., 8.5000.
Let the loop counter i count stations; you can always insert additional code into the body of the loop to calculate where a particular section is located.
 

1. What is Simpson's rule with changing volumes?

Simpson's rule with changing volumes is a mathematical method used to approximate the volume of a three-dimensional object that has a continuously changing cross-sectional area. It is named after the mathematician Thomas Simpson and is a more accurate method than the traditional trapezoidal rule.

2. How does Simpson's rule with changing volumes work?

This method works by dividing the object into smaller sections and approximating the volume of each section using Simpson's rule. The volume of the entire object is then calculated by summing up the volumes of all the sections.

3. When is Simpson's rule with changing volumes used?

Simpson's rule with changing volumes is commonly used in physics and engineering to calculate the volume of objects with complex shapes, such as curved pipes or tanks. It is also used in numerical integration to approximate the area under a curve.

4. What are the advantages of using Simpson's rule with changing volumes?

One of the main advantages of this method is its accuracy. It can provide more precise results compared to other numerical integration techniques, especially for objects with changing cross-sectional areas. It is also relatively easy to use and can handle a wide range of object shapes.

5. Are there any limitations to Simpson's rule with changing volumes?

While Simpson's rule with changing volumes is generally accurate, it can still produce errors when used to approximate the volume of highly irregular or asymmetrical objects. It also requires a significant amount of calculation, which can be time-consuming for complex objects.

Similar threads

Replies
31
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
5K
Replies
5
Views
2K
  • Introductory Physics Homework Help
Replies
11
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
9K
Replies
2
Views
2K
  • Introductory Physics Homework Help
Replies
9
Views
3K
Replies
18
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
19K
Back
Top