|
-
Mar 19th, 2004, 04:11 PM
#1
Thread Starter
PowerPoster
Ellipse [Resolved]
Hi,
I need to be able to calculate the amount of liquid remaining in an oval tank at various levels, so that I can graduate a dipstick.
I have obtained some help as follows: (I have difficulty in copying some of the symbols and have explained them where relevent)
-----------------------------------------------------------------------------------
let's say your ellipse has it's centre on the origin, and goes through the points
x=0,y=b; x=0,y=-b; x=a,y=0; x=-a,y=0
i.e. it has width 2a and height 2b. now the equation of the ellipse is given by
(x/a)^2 + (y/b)^2 = 1
i can prove this from something else if you want, but usually it is taken as the defenition of an ellipse.
now you want to find the area between the line y=k and the ellipse, k<b. to do this rearrange the equation:
x=a@(1 - (y/b)^2 ) ("@" should be a square root sign which I do not have on my keyboard)
and concentrate on y and x both greater than 0. now the area between the "top" of the ellipse and the line y=k is given by
y=b y=k a@(1 - (y/b)^2 ) dy. ("y=b" & "y=k" are interlined and preceded by a squiggle which looks like a vertically extended "S")
you should be able to do this integral with a simple substitution - let y = bsinq ("q" is the greek letter Theta which stands for an angle)"
------------------------------------------------------------------------------
My problem is that my knowledge of Integration is virtually non-existent. Could someone please help me to interpret what I actually have to work out so that I can write a programme to do it.
For an example, assume an elipse 2.5 metres wide and 1.5 metres in height.
Obviously all I need to know is how to calculate the relative area of the ellipse and the finding the volume will be easy.
Last edited by taxes; Mar 20th, 2004 at 10:19 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 20th, 2004, 02:04 AM
#2
VB Code:
Private Function Test(ByVal r1 As Decimal, _
ByVal r2 As Decimal, ByVal h As Decimal) As Decimal
Dim decTemp As Decimal = (Math.PI * r1 * r2)
decTemp -= (r1 * r2) * Math.Asin(1 - (h / r1))
decTemp -= (r1 - h) * Math.Sqrt(h * (2 * r1 - h))
Return decTemp
End Function
how does this work? I adapted it from code that i used for a circle and i dont got very good math skillz.
VB Code:
'Tested it like this
Msgbox (2.5*1.5*Math.PI)
Msgbox Test(2.5,1.5,2.5)
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Mar 20th, 2004, 03:40 AM
#3
-
Mar 20th, 2004, 09:23 PM
#4
Thread Starter
PowerPoster
Hi ABX.
Many thanks. Please confirm what it is that your formula produces. I have tried several calculations and I think that it calculates the area between the line representing the level of the liquid and the horizontal axis - and assumes that the tank would be over half full. Am I correct?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 20th, 2004, 09:45 PM
#5
Thread Starter
PowerPoster
Hi sql_lall,
"try the BEST integral resource:
http://integrals.wolfram.com/
Otherwise, it's a bit hard to read that, would you be able to draw it in a picture, so it makes a bit more sense? Thanks"
Imagine an ellipse x=0 y=4; x=0 y=-4; x=7 y=0; x=-7 y=0.
A line K lies at y=3
I need to know one of the following: the area lying between:
1. Under K and within the Ellipse; or
2. Above K and within the ellipse or
3. Between K and the horizontal (x) axis of the ellipse.
The site you gave is certainly impressive, but I just cannot see how to use it at the moment.
Many thanks.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 20th, 2004, 09:51 PM
#6
I was not sure as I am not a math person so i googled and found this: http://mathforum.org/library/drmath/view/55296.html
A = a*b*(Pi/2 + Arcsin[d/a]) + b*d*sqrt(a^2-d^2)/a
A=Area of ellipes
a=Radius 1
b=Radius 2
so to apply it...
VB Code:
Private Function TestIt(ByVal r1 As Decimal, ByVal r2 As Decimal, ByVal d As Decimal) As Decimal
'A = a*b*(Pi/2 + Arcsin[d/a]) + b*d*sqrt(a^2-d^2)/a
Return r1 * r2 * (Math.PI / 2 + Math.Asin(d / r1)) + _
(r2 * d * Math.Sqrt(r1 ^ 2 - d ^ 2) / r1)
End Function
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Mar 20th, 2004, 10:19 PM
#7
Thread Starter
PowerPoster
Hi ABX,
Brilliant site
Thanks a million.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|