| View previous topic :: View next topic |
| Author |
Message |
midan Newbie

Joined: 11 Feb 2009 Posts: 2
|
Posted: Wed Feb 11, 2009 2:59 am Post subject: Calc rise to power |
|
|
I need to resolve this formula S=(J3+SQRT(I3^3+J3^2))^(1/3) where
i3=-0.1111111 and j3=-0.9629630 i get an "#VALUE!" result
for other values like i3=0.5 and j3=0.4 is ok
---
Sorry for my bad english |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed Feb 11, 2009 5:32 am Post subject: |
|
|
You try to get the root of a negative number. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
midan Newbie

Joined: 11 Feb 2009 Posts: 2
|
Posted: Wed Feb 11, 2009 6:30 am Post subject: |
|
|
Calculated with OOCalc I3^3+J3^2=0.9259259 , is greather then 0
(J3+SQRT(I3^3+J3^2))=-0.0007125
the problem is in this step -0.0007125^(1/3) |
|
| Back to top |
|
 |
keme Moderator


Joined: 30 Aug 2004 Posts: 2744 Location: Egersund, Norway
|
Posted: Wed Feb 11, 2009 1:32 pm Post subject: |
|
|
To find the cubic root of a negative base, you can use IMABS(IMPOWER(base;1/3))*SIGN(base). It's useful to find the base first (a cell with an intermediate calculation). Explanation follows...
With integer powers, Calc will use the "natural" procedure, and all is well. If the exponent is not an integer, Calc will use a different way to calculate the power. This involves using logarithms, which do not work well with negative arguments.
Some math knowledge is necessary:
When the base is negative and the exponent is a fraction, the power will be a number somewhere in the complex plane. Generally we do not know that the power has an answer in the real numbers (i.e. no imaginary part). However, with the exponent of 1/3 we know that for every real base there is a real answer.
Still, in this situation we need to use the tools for working with complex numbers, the IM...() functions.
Say we have the number to find the cube root of in cell A1. =IMPOWER(A1;1/3) will give a correct answer in the complex plane, but never the real number we want.
However, we know that all answers will have the same absolute value, so we'll extract that: =IMABS(IMPOWER(A1;1/3)).
The absolute value is always a positive number, but the root will have the same sign as the base, so to keep the sign: =IMABS(IMPOWER(A1;1/3))*SIGN(A1) |
|
| Back to top |
|
 |
Ed Super User

Joined: 28 May 2003 Posts: 1040
|
Posted: Wed Feb 11, 2009 2:07 pm Post subject: |
|
|
| keme wrote: | | To find the cubic root of a negative base, you can use IMABS(IMPOWER(base;1/3))*SIGN(base). It's useful to find the base first (a cell with an intermediate calculation). |
For a cube root, you could use SIGN(base)*ABS(base)^(1/3). Of course if you know that base is a negative number then you could just use -(-base)^(1/3)
Avoiding the use of complex number functions should make the calculation more accurate. |
|
| Back to top |
|
 |
keme Moderator


Joined: 30 Aug 2004 Posts: 2744 Location: Egersund, Norway
|
Posted: Wed Feb 11, 2009 2:09 pm Post subject: |
|
|
Of course, but where's the fun in that...
<hiding face in hands and will not be able to face other people for a week at least> |
|
| Back to top |
|
 |
bblackmoor Newbie

Joined: 11 Jan 2007 Posts: 4
|
Posted: Wed Jul 29, 2009 2:16 pm Post subject: Re: Calc rise to power |
|
|
| midan wrote: | I need to resolve this formula S=(J3+SQRT(I3^3+J3^2))^(1/3) where
i3=-0.1111111 and j3=-0.9629630 i get an "#VALUE!" result
for other values like i3=0.5 and j3=0.4 is ok |
The problem is that OpenOffice Calc returns an error when it attempts to find the root of a negative number, because it uses flawed logic to determine the value of roots (i.e., not taking into account the sign of the base) -- a bug it has had for at least four years, and probably since its creation.
Yes, you can do it manually: you should not need to.
Microsoft Excel does not have this bug. Every time I have a conversation with someone and I tell them they have no need to ever use Microsoft Office again, this years-old trival-to-fix bug sits on my shoulder and laughs at me. |
|
| Back to top |
|
 |
|