You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openoffice.apache.org by "Easton, William" <je...@ucsd.edu> on 2012/06/07 02:04:00 UTC

Complex numbers in functions

I am having difficulties trying to do complex number calculations.

First, it is a real pain to have to use functions for ordinary operations. I would like to propose a simple switch that might pop up if a complex number were detected substituting the complex versions of *,/,+,- for the real counterparts. Even more radical would be to do the same for functions, but one might need a compatibility mode.

However, I am finding that things like improduct(1+2j;3-4j) do not work.

Advice? Thoughts?

Thank you.

Jim Easton
858-527-0240
---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by Rob Weir <ro...@apache.org>.
On Wed, Jun 6, 2012 at 10:35 PM, Shan Zhu <sh...@gmail.com> wrote:
> Getting 9 as a result, it causes by incorrect parameter format in your
> formula.
> The complex number should be put in a pair of double quotation marks, like
> this:=IMPRODUCT("3+4i";"3-4i")
> The formula =IMPRODUCT(3+i4,3-i4) will be regarded as (3+ (value in cell
> i4))*(3-(value in cell i4)), so it returns 9.
> The formula =IMPRODUCT(2+i2,0.5-i.5), i.5 is not a valid cell reference, so
> #REF returned.
>

Complex number support in spreadsheets is an afterthought.  It doesn't
work very well.  This is not just AOO, but all spreadsheets.  (Or does
Gnumeric do something better?  They seem to have more of a
scientific/engineering focus.)

Much of the disconnect comes from ambiguities with cell references and
range names.  i4 -- is that cell i4?  a range name called i4?  Or 4 *
sqrt(-1)?

At the file format level we have ways of making this clear.  But at
the UI level it is still a mess, and we basically have two choices:

1) Do it the way Microsoft Excel does the UI, so user's can reuse what
they already know about spreadsheets when they move to Calc

or

2) So something new and consistent, where complex numbers are first
class citizens, where booleans are not just integers, where dates obey
leap year rules and are not just numbers reformatted, where "1%%" is
an error and not just treated as 1% of 1%, where numeric calculations
follow IEEE rules related to overflow, underflow and NaN, where blanks
and missing values are treated consistently and not just sometimes
treated as zeros, etc.

There are a lot of ways in which spreadsheets formulas could be made
more logical and consistent.  But so far, the needs of legacy
compatibility has been the predominant force influencing how formulas
in Calc (and in ODF) work.

-Rob

> Regards, Shan Zhu
>
>
> 2012/6/7 Dan Lewis <el...@gmail.com>
>
>> Easton, William wrote:
>>
>>> I am having difficulties trying to do complex number calculations.
>>>
>>> First, it is a real pain to have to use functions for ordinary
>>> operations. I would like to propose a simple switch that might pop up if a
>>> complex number were detected substituting the complex versions of *,/,+,-
>>> for the real counterparts. Even more radical would be to do the same for
>>> functions, but one might need a compatibility mode.
>>>
>>> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>>>
>>> Advice? Thoughts?
>>>
>>> Thank you.
>>>
>>> Jim Easton
>>> 858-527-0240
>>>
>>      I would not trust IMPRODUCT() to do calculations: they are not
>> correct.
>> For example, I made this calculation:   =IMPRODUCT(3+i4,3-i4). The answer
>> given was 9. But this is just the product of the real numbers. The correct
>> answer is 25 (3*3 +3*i4 -3*i4 +4*4).
>>      I also discovered that it may not work with fractions:
>> =IMPRODUCT(2+i2,0.5-i.5). Calc gives an error: #REF.
>>
>> --Dan
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: ooo-users-unsubscribe@**incubator.apache.org<oo...@incubator.apache.org>
>> For additional commands, e-mail: ooo-users-help@incubator.**apache.org<oo...@incubator.apache.org>
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


RE: Complex numbers in functions

Posted by Maurice Howe <ma...@stny.rr.com>.
That's interesting (and educational) --
http://en.wikipedia.org/wiki/Quotation_mark
Just proves, "You're never too old to learn."  [But at 82, I may be getting
close...]
Thanks for setting me straight.

Maurice

-----Original Message-----
From: M Henri Day [mailto:mhenriday@gmail.com] 
Sent: Friday, June 08, 2012 6:35 PM
To: ooo-users@incubator.apache.org
Subject: Re: Complex numbers in functions

2012/6/9 Maurice Howe <ma...@stny.rr.com>

> Just a minor point: a quote symbol looks like this: "
> A double quote would look like this: "" (although I've never seen it
used).
> This is an apostrophe: '
> This is a double apostrophe: '' (also never used).
> Yes, it's an accident of topography that they look the same, but they 
> ain't!
>
>
> Maurice D. Howe
>

Maurice, you may be interested to learn what the English-language version of
Wikipedia has to say on the matter : *
http://en.wikipedia.org/wiki/Quotation_mark*<http://en.wikipedia.org/wiki/Qu
otation_mark>

Henri

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2178 / Virus Database: 2433/5056 - Release Date: 06/08/12


---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by M Henri Day <mh...@gmail.com>.
2012/6/9 Maurice Howe <ma...@stny.rr.com>

> Just a minor point: a quote symbol looks like this: "
> A double quote would look like this: "" (although I've never seen it used).
> This is an apostrophe: '
> This is a double apostrophe: '' (also never used).
> Yes, it's an accident of topography that they look the same, but they
> ain't!
>
>
> Maurice D. Howe
>

Maurice, you may be interested to learn what the English-language version
of Wikipedia has to say on the matter : *
http://en.wikipedia.org/wiki/Quotation_mark*<http://en.wikipedia.org/wiki/Quotation_mark>

Henri

RE: Complex numbers in functions

Posted by Maurice Howe <ma...@stny.rr.com>.
Just a minor point: a quote symbol looks like this: "
A double quote would look like this: "" (although I've never seen it used).
This is an apostrophe: '
This is a double apostrophe: '' (also never used).
Yes, it's an accident of topography that they look the same, but they ain't!


Maurice D. Howe
General MacArthur Honor Guard Assn
616 Lacey Drive
Endwell, NY 13760
607-754-0469
Maurice@stny.rr.com
 


-----Original Message-----
From: M Henri Day [mailto:mhenriday@gmail.com] 
Sent: Friday, June 08, 2012 2:40 PM
To: ooo-users@incubator.apache.org
Subject: Re: Complex numbers in functions

2012/6/7 Shan Zhu <sh...@gmail.com>

> Getting 9 as a result, it causes by incorrect parameter format in your 
> formula.
> The complex number should be put in a pair of double quotation marks, 
> like
> this:=IMPRODUCT("3+4i";"3-4i")
> The formula =IMPRODUCT(3+i4,3-i4) will be regarded as (3+ (value in 
> cell i4))*(3-(value in cell i4)), so it returns 9.
> The formula =IMPRODUCT(2+i2,0.5-i.5), i.5 is not a valid cell 
> reference, so #REF returned.
>
> Regards, Shan Zhu
>

Shan Zhu's instructions work fine for me ; after clicking the cell into
which I wish to enter the desired product, I then click the functions-guide
icon (*f(x)*) at the top of the spreadsheet, select <IMPRODUCT> from the
left panel in the box that then displays, and click <Next> in the bottom
row. In the right panel a list entitled <Complex numbers> now appears ; I
enter the complex numbers (in the form "a+bi") I wish to multiply into the
the boxes (which are ordered <Complex mumber, Complex number1, Complex
number2,>, etc,) in the list, after which the result of the operation
appears in the <Result box>. To move this result into the cell I've picked,
I then click <OK> in the bottom row.
<IMPRODUKT("3+4i";"3-4i";"3+4i";"3-4i")> entered in this manner gives 625 as
the product, which seems entirely satisfactory to me. But don't forget those
double quotation marks !...

Henri

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2178 / Virus Database: 2433/5056 - Release Date: 06/08/12


---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by M Henri Day <mh...@gmail.com>.
2012/6/7 Shan Zhu <sh...@gmail.com>

> Getting 9 as a result, it causes by incorrect parameter format in your
> formula.
> The complex number should be put in a pair of double quotation marks, like
> this:=IMPRODUCT("3+4i";"3-4i")
> The formula =IMPRODUCT(3+i4,3-i4) will be regarded as (3+ (value in cell
> i4))*(3-(value in cell i4)), so it returns 9.
> The formula =IMPRODUCT(2+i2,0.5-i.5), i.5 is not a valid cell reference, so
> #REF returned.
>
> Regards, Shan Zhu
>

Shan Zhu's instructions work fine for me ; after clicking the cell into
which I wish to enter the desired product, I then click the functions-guide
icon (*f(x)*) at the top of the spreadsheet, select «IMPRODUCT» from the
left panel in the box that then displays, and click «Next» in the bottom
row. In the right panel a list entitled «Complex numbers» now appears ; I
enter the complex numbers (in the form "a+bi") I wish to multiply into the
the boxes (which are ordered «Complex mumber, Complex number1, Complex
number2,», etc,) in the list, after which the result of the operation
appears in the «Result box». To move this result into the cell I've picked,
I then click «OK» in the bottom row.
«IMPRODUKT("3+4i";"3-4i";"3+4i";"3-4i")» entered in this manner gives 625
as the product, which seems entirely satisfactory to me. But don't forget
those double quotation marks !...

Henri

Re: Complex numbers in functions

Posted by Fred Juan DIAZ <fr...@gmail.com>.
Hi
an old file made with OOo2 in 2009. It should work.
It contains nearly all usual features about complex in elec

http://campuslibre.educoo.org/courses/BACPROM/document/9B_Nombres_complexes/complexes.ods


I hope that localisation (translation) of used functions will be ok

if useful...

Fred Juan Diaz

=====================


2012/6/7, Shan Zhu <sh...@gmail.com>:
> Getting 9 as a result, it causes by incorrect parameter format in your
> formula.
> The complex number should be put in a pair of double quotation marks, like
> this:=IMPRODUCT("3+4i";"3-4i")
> The formula =IMPRODUCT(3+i4,3-i4) will be regarded as (3+ (value in cell
> i4))*(3-(value in cell i4)), so it returns 9.
> The formula =IMPRODUCT(2+i2,0.5-i.5), i.5 is not a valid cell reference, so
> #REF returned.
>
> Regards, Shan Zhu
>
>
> 2012/6/7 Dan Lewis <el...@gmail.com>
>
>> Easton, William wrote:
>>
>>> I am having difficulties trying to do complex number calculations.
>>>
>>> First, it is a real pain to have to use functions for ordinary
>>> operations. I would like to propose a simple switch that might pop up if
>>> a
>>> complex number were detected substituting the complex versions of
>>> *,/,+,-
>>> for the real counterparts. Even more radical would be to do the same for
>>> functions, but one might need a compatibility mode.
>>>
>>> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>>>
>>> Advice? Thoughts?
>>>
>>> Thank you.
>>>
>>> Jim Easton
>>> 858-527-0240
>>>
>>      I would not trust IMPRODUCT() to do calculations: they are not
>> correct.
>> For example, I made this calculation:   =IMPRODUCT(3+i4,3-i4). The answer
>> given was 9. But this is just the product of the real numbers. The
>> correct
>> answer is 25 (3*3 +3*i4 -3*i4 +4*4).
>>      I also discovered that it may not work with fractions:
>> =IMPRODUCT(2+i2,0.5-i.5). Calc gives an error: #REF.
>>
>> --Dan
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail:
>> ooo-users-unsubscribe@**incubator.apache.org<oo...@incubator.apache.org>
>> For additional commands, e-mail:
>> ooo-users-help@incubator.**apache.org<oo...@incubator.apache.org>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by Shan Zhu <sh...@gmail.com>.
Getting 9 as a result, it causes by incorrect parameter format in your
formula.
The complex number should be put in a pair of double quotation marks, like
this:=IMPRODUCT("3+4i";"3-4i")
The formula =IMPRODUCT(3+i4,3-i4) will be regarded as (3+ (value in cell
i4))*(3-(value in cell i4)), so it returns 9.
The formula =IMPRODUCT(2+i2,0.5-i.5), i.5 is not a valid cell reference, so
#REF returned.

Regards, Shan Zhu


2012/6/7 Dan Lewis <el...@gmail.com>

> Easton, William wrote:
>
>> I am having difficulties trying to do complex number calculations.
>>
>> First, it is a real pain to have to use functions for ordinary
>> operations. I would like to propose a simple switch that might pop up if a
>> complex number were detected substituting the complex versions of *,/,+,-
>> for the real counterparts. Even more radical would be to do the same for
>> functions, but one might need a compatibility mode.
>>
>> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>>
>> Advice? Thoughts?
>>
>> Thank you.
>>
>> Jim Easton
>> 858-527-0240
>>
>      I would not trust IMPRODUCT() to do calculations: they are not
> correct.
> For example, I made this calculation:   =IMPRODUCT(3+i4,3-i4). The answer
> given was 9. But this is just the product of the real numbers. The correct
> answer is 25 (3*3 +3*i4 -3*i4 +4*4).
>      I also discovered that it may not work with fractions:
> =IMPRODUCT(2+i2,0.5-i.5). Calc gives an error: #REF.
>
> --Dan
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: ooo-users-unsubscribe@**incubator.apache.org<oo...@incubator.apache.org>
> For additional commands, e-mail: ooo-users-help@incubator.**apache.org<oo...@incubator.apache.org>
>
>

Re: Complex numbers in functions

Posted by Dan Lewis <el...@gmail.com>.
Easton, William wrote:
> I am having difficulties trying to do complex number calculations.
>
> First, it is a real pain to have to use functions for ordinary operations. I would like to propose a simple switch that might pop up if a complex number were detected substituting the complex versions of *,/,+,- for the real counterparts. Even more radical would be to do the same for functions, but one might need a compatibility mode.
>
> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>
> Advice? Thoughts?
>
> Thank you.
>
> Jim Easton
> 858-527-0240
       I would not trust IMPRODUCT() to do calculations: 
they are not correct.
For example, I made this calculation:   
=IMPRODUCT(3+i4,3-i4). The answer given was 9. But this is 
just the product of the real numbers. The correct answer is 
25 (3*3 +3*i4 -3*i4 +4*4).
       I also discovered that it may not work with 
fractions: =IMPRODUCT(2+i2,0.5-i.5). Calc gives an error: #REF.

--Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by NoOp <gl...@sbcglobal.net>.
On 06/06/2012 06:12 PM, Dan Lewis wrote:
> Easton, William wrote:
>> I am having difficulties trying to do complex number calculations.
>>
>> First, it is a real pain to have to use functions for ordinary operations. I would like to propose a simple switch that might pop up if a complex number were detected substituting the complex versions of *,/,+,- for the real counterparts. Even more radical would be to do the same for functions, but one might need a compatibility mode.
>>
>> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>>
>> Advice? Thoughts?
>>
...
>       Suggestion: While Excel uses semicolons (;) in its 
> functions, Calc uses commas (,):
>                improduct(1+2j,3-4j)

I think you have that backwords :-)

When all else fails, try F1/Help:

>From "About Converting Microsoft Office Documents"
<quote>
7. Some functions/formulas (see below)
One example of differences between Calc and Excel is the handling of
boolean values. Enter TRUE to cells A1 and A2.
In Calc, the formula =A1+A2 returns the value 2, and the formula
=SUM(A1;A2) returns 2.
In Excel, the formula =A1+A2 returns 2, but the formula =SUM(A1,A2)
returns 0.

For a detailed overview about converting documents to and from Microsoft
Office format, see the Migration Guide.
</quote>


>       What help does not seem to tell you is that complex 
> numbers should be written in this form:
> the  i or j used for the imaginary part of the complex 
> number should come first. Hence, your complex numbers can be 
> one of these: 1+i2 or 1+j2; 3-i4 or 3-j4. If you do not do 
> this, you will get  #NAME as a result.
> 
>            Try improduct(1+j2,3-j4). It should give you the 
> desired result.

Again, from the Help file:

<quote>
IMPRODUCT
The result is the product of up to 29 complex numbers.
Syntax
IMPRODUCT("ComplexNumber"; "ComplexNumber1"; ...)
ComplexNumber is a complex number that is entered in the form "x+yi" or
"x+yj".
Example
=IMPRODUCT("3+4j";"5-3j") returns 27+11j.
</quote>

=IMPRODUCT("3+4j";"5-3j") works for me.




---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org


Re: Complex numbers in functions

Posted by Dan Lewis <el...@gmail.com>.
Easton, William wrote:
> I am having difficulties trying to do complex number calculations.
>
> First, it is a real pain to have to use functions for ordinary operations. I would like to propose a simple switch that might pop up if a complex number were detected substituting the complex versions of *,/,+,- for the real counterparts. Even more radical would be to do the same for functions, but one might need a compatibility mode.
>
> However, I am finding that things like improduct(1+2j;3-4j) do not work.
>
> Advice? Thoughts?
>
> Thank you.
>
> Jim Easton
> 858-527-0240
      Suggestion: While Excel uses semicolons (;) in its 
functions, Calc uses commas (,):
               improduct(1+2j,3-4j)
      What help does not seem to tell you is that complex 
numbers should be written in this form:
the  i or j used for the imaginary part of the complex 
number should come first. Hence, your complex numbers can be 
one of these: 1+i2 or 1+j2; 3-i4 or 3-j4. If you do not do 
this, you will get  #NAME as a result.

           Try improduct(1+j2,3-j4). It should give you the 
desired result.

--Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: ooo-users-unsubscribe@incubator.apache.org
For additional commands, e-mail: ooo-users-help@incubator.apache.org