Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenThu, 30 Jul 2020 17:03:41 +0200Entering complex formulas in Calchttps://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/I am trying to add a formula on a worksheet in Calc. It is a complex formula, and I have tried all kinds of ways to enter it but none of them work - I always get an "invalid argument" error or something like that. It is the formula for calculating the volume of a substance (usually a liquid) in a tank (cylinder) of a certain radius and height.
Here is the formula (as I understand it)
---------------------------------------------------------------------------
L(R^2 cos-1 ((R-D)/R) - (R-D) sqrt(2RD-D^2)
where:
R is the radius of the cylinder.
D is the depth.
L is the length of the cylinder
---------------------------------------------------------------------------
That is the best I can do on the formula, as this text editor doesn't have some ways (that I can see) to express some things in the formula (squared, square root, cos-1 is actually cos^-1 [I think], etc). I hope it is not forbidden to post links to something in a question post, I am going to have to hope it isn't --- so that anyone reading this that might know how to set up this formula can look at it and give me some help.
[link text](https://www.mathopenref.com/cylindervolpartial.html).
I knew that R D and L would have to have their own cells, and did that. I thought maybe cos needed to be worked separately in it's own cell, so I did **that**. And I figured maybe the square root would need to be done in it's own cell so I did **that**. Still no luck. Always get the error. Any help that someone could give me on this would be **greatly** appreciated. Thanks!
----------
----------
Thu, 30 Jul 2020 15:05:55 +0200https://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/Answer by Opaque for <p>I am trying to add a formula on a worksheet in Calc. It is a complex formula, and I have tried all kinds of ways to enter it but none of them work - I always get an "invalid argument" error or something like that. It is the formula for calculating the volume of a substance (usually a liquid) in a tank (cylinder) of a certain radius and height.</p>
<h2>Here is the formula (as I understand it)</h2>
<pre><code> L(R^2 cos-1 ((R-D)/R) - (R-D) sqrt(2RD-D^2)
</code></pre>
<p>where:
R is the radius of the cylinder.
D is the depth.
L is the length of the cylinder </p>
<hr>
<p>That is the best I can do on the formula, as this text editor doesn't have some ways (that I can see) to express some things in the formula (squared, square root, cos-1 is actually cos^-1 [I think], etc). I hope it is not forbidden to post links to something in a question post, I am going to have to hope it isn't --- so that anyone reading this that might know how to set up this formula can look at it and give me some help.
<a href="https://www.mathopenref.com/cylindervolpartial.html">link text</a>.</p>
<p>I knew that R D and L would have to have their own cells, and did that. I thought maybe cos needed to be worked separately in it's own cell, so I did <strong>that</strong>. And I figured maybe the square root would need to be done in it's own cell so I did <strong>that</strong>. Still no luck. Always get the error. Any help that someone could give me on this would be <strong>greatly</strong> appreciated. Thanks!</p>
<hr>
<hr>
https://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/?answer=257895#post-id-257895Hello,
asssuming:
**Radius** in cell `B3`
**Length** in cell `B4`
**Depth** in cell `B5` (I'd call this *fill height* or *liquid height*)
then the formula is:
`=B4*(B3^2*ACOS(1-B5/B3)-(B3-B5)*SQRT(2*B3*B5-B5^2))` where I set `(R-D)/R` = `1-R/D`)
See also the following sample file: [C:\fakepath\Cylinder.ods](/upfiles/15961180292790835.ods)
**Please note** The sample file or its formula doesn't contain any checking (e.g. *Depth* must not be grater than 2**Radius*)
Hope that helps.
Thu, 30 Jul 2020 16:09:30 +0200https://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/?answer=257895#post-id-257895Comment by SteveH_66 for <p>Hello,</p>
<p>asssuming:</p>
<p><strong>Radius</strong> in cell <code>B3</code> <br>
<strong>Length</strong> in cell <code>B4</code> <br>
<strong>Depth</strong> in cell <code>B5</code> (I'd call this <em>fill height</em> or <em>liquid height</em>) </p>
<p>then the formula is:</p>
<p><code>=B4*(B3^2*ACOS(1-B5/B3)-(B3-B5)*SQRT(2*B3*B5-B5^2))</code> where I set <code>(R-D)/R</code> = <code>1-R/D</code>)</p>
<p>See also the following sample file: <a href="/upfiles/15961180292790835.ods">C:\fakepath\Cylinder.ods</a></p>
<p><strong>Please note</strong> The sample file or its formula doesn't contain any checking (e.g. <em>Depth</em> must not be grater than 2<em>*Radius</em>)</p>
<p>Hope that helps.</p>
https://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/?comment=257901#post-id-257901That worked great Opaque! Many thanksThu, 30 Jul 2020 17:03:41 +0200https://ask.libreoffice.org/en/question/257881/entering-complex-formulas-in-calc/?comment=257901#post-id-257901