Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Education > Algebra help > Re: Formula Hel...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 6 Topic 1944 of 2129
Post > Topic >>

Re: Formula Help

by "Brian M. Scott" <b.scott@[EMAIL PROTECTED] > Dec 30, 2007 at 10:16 PM

On Sun, 30 Dec 2007 13:22:30 -0800 (PST), 
<bradeatspoo@[EMAIL PROTECTED]
> wrote in 
<news:813841bf-5512-4c47-98f9-769d92bde6e0@[EMAIL PROTECTED]
> 
in alt.algebra.help:

> I am a computer program 

And a very good one, too!  <g>

> and not a mathematician.  I use the equations below to
> calculate Gallons when I have the Radius, Depth and
> Length of an oil tank.  However, sometimes I need to
> calculate Depth when I have the Radius, Length and
> Gallons.  Any help in reworking these formulas would be
> greatly appreciated.

> If iDepth <= iRadius Then

>             iGals = ((iRadius * iRadius * Acos((iRadius - iDepth) /
> iRadius)) - ((iRadius - iDepth) * Sqrt(2 * iRadius * iDepth - iDepth *
> iDepth))) * iLength / 231

> Else
>             iGals = ((PI * iRadius * iRadius) - ((iRadius * iRadius *
> Acos((iRadius - (2 * iRadius - iDepth)) / iRadius)) - ((iRadius - (2 *
> iRadius - iDepth)) * Sqrt(2 * iRadius * (2 * iRadius - iDepth) - ((2 *
> iRadius - iDepth) * (2 * iRadius - iDepth)))))) * iLength / 231

> End If

Judging from these formulae, it's a cylindrical tank lying 
on its side.  Its length in inches is iLength, its radius in 
inches is iRadius, and iDepth is the depth of the fluid in 
inches, measured at the centre of the tank.

The problem isn't amenable to solution in closed form: 
you're not going to get a formula that gives you iDepth in 
terms of iGals, iRadius, and iDepth.  The easiest practical 
solution is probably to write a routine that gets a 
sufficiently accurate value by successive approximation, 
using the formulae that you already have.

For convenience I'll introduce some additional variables.  
First, set iArea = 231 * iGals / iLength; this is the area 
in square inches of the submerged part of a vertical 
cross-section through the tank.  Its maximum value is of 
course the cross-sectional area of the tank,
PI * iRadius * iRadius.  Assume first that 
iArea <= PI * iRadius * iRadius / 2, so that 
iDepth <= iRadius.

Take iD to be an initial approximation to iDepth.  It 
needn't be particularly good; 

   iD = 2 * iArea / (PI * iRadius)
   
will do.  Let 

   iX = iRadius - iD 

and 

   iY = Sqrt(iRadius * iRadius - iX * iX).
   
Recalculate iX according to the formula:

   iX = iX / 2 + (iRadius * iRadius * Acos(iX / iRadius) -
iArea) / (2 * iY)

Update iD:

   iD = iRadius - iX
   
This will be a better approximation to iDepth.  Repeat until 
you reach a satisfactory level of accuracy.  You can test 
the accuracy in at least two ways.  First, you can use iD 
for iDepth in your formula to see whether it yields a value 
for iGals sufficiently close to the known value.  Secondly, 
you can keep track of the changes in iD and make sure that 
they're small.  (You may want to use both.)  Convergence was 
very rapid in all of the examples that I tested.

If iArea > PI * iRadius * iRadius / 2, you can proceed as 
follows.  First let iArea = PI * iRadius * iRadius - iArea; 
this is the area of the part of the cross-section that 
*isn't* submerged.  Next, carry out the procedure described 
above.  When you've reached a satisfactory level of 
accuracy, replace iD by 2 * iRadius - iD; this will be the 
desired approximation to iDepth.

Brian
 




 6 Posts in Topic:
Formula Help
bradeatspoo@[EMAIL PROTEC  2007-12-30 13:22:30 
Re: Formula Help
"Brian M. Scott"  2007-12-30 22:16:11 
Re: Formula Help
David W. Cantrell <DWC  2007-12-31 04:58:05 
Re: Formula Help
bradeatspoo@[EMAIL PROTEC  2007-12-30 21:22:33 
Re: Formula Help
David W. Cantrell <DWC  2008-01-01 00:14:29 
Re: Formula Help
bradeatspoo@[EMAIL PROTEC  2008-01-03 15:00:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 7:53:45 CDT 2008.