1
$\begingroup$

I'm attempting to program a formula to say how full an horizontal cylinder is with liquid. Here is the formula I am using with variables from measurements I took:

enter image description here

When I use Wolframalpha to solve this I end up getting a complex number, and quite frankly I'm not quite sure what to do with it(link here). I need a real number in cubic inches or gallons to obtain my end goals.

Can someone help me to understand why I a getting a complex number and how I can possibly get a real number? A different formula maybe? This website does the calculations I want, but I have no idea how it does it.

  • 4
    If you are computing $\cos^{-1} x$ and $x$ is not between $-1$ and $1$, you are going to get a complex value. The problem is that there is something wrong with your formula.2012-07-12
  • 0
    A similar problem came up in another post a day or so ago. I'd guess that W|A gave you an answer with a very small imaginary term. If that's the case, just ignore the imaginary part as an artifact of what's going on under the W|A hood, so to speak.2012-07-12
  • 3
    If you look at the Alpha result, the argument of $\cos^{-1}$ is $\frac{1-384\sqrt 2}3$, far outside $[-1,1]$.2012-07-12
  • 0
    A good thought, Rick (and my first thought, as well). It turns out in this case that OP's formula is incorrect.2012-07-12
  • 1
    @Cameron. You're right--there's a misplaced parenthesis.2012-07-12

2 Answers 2