
1. Re: Complex (imaginary) numbers
Shinichiro Murakami Mar 7, 2017 4:44 AM (in response to Martin Dale)Hi Martin
I think Tableau can do the calc as long as the complexity of the formula is below level.
sqrt(average of the real parts ^2 + average of imaginary parts^2).
But that really depends on your data structure.
If you attach packaged workbook, community members will easily help for more detailed solution.
Thanks,
Shin

2. Re: Complex (imaginary) numbers
Martin Dale Mar 7, 2017 4:53 AM (in response to Shinichiro Murakami)Ideally I'd like to know if Tableau can handle a complex number datatype natively i.e. (X+Yi) as a single entity rather than as two individual numbers for the real and imaginary parts.

3. Re: Complex (imaginary) numbers
Michael Hesser Mar 7, 2017 5:02 AM (in response to Martin Dale)Hi Martin;
I'm less convinced than Shin regarding this calculation:
sqrt(average of the real parts ^2 + average of imaginary parts^2)
This is because if your average of imaginary parts > average of real parts, you'll be trying to compute the square root of a negative number (i squared is 1) and get an error.
I think you can avoid this situation by using a simple IF clause first:
Create a calc adding the two
REAL PLUS IMAGINARY SQUARED
(average of the real parts ^2 + average of imaginary parts^2)
Now use an IF statement in a second calc:
SQUAREROOTER
IF [REAL PLUS IMAGINARY SQUARED] >= 0 then STR((SQRT([REAL PLUS IMAGINARY SQUARED]))
ELSEIF STR((SQRT([REAL PLUS IMAGINARY SQUARED]))+"i"
END
Here I'm adding "i" to any imaginary result... I'm also converting them as STRINGS.
If you know your imaginary values will always be less than your real values, you;ll be OKAY.
Michael

4. Re: Complex (imaginary) numbers
Martin Dale Mar 7, 2017 5:21 AM (in response to Michael Hesser)Michael,
It is only the component of imaginary part that is squared and summed, not the "i" itself. For example the average of 2+5i & 4+3i is (2+4)/2 + (5+3)/2i = 3+4i and its magnitude would be sqrt(3^2+4^2) = 5
If you type the following in to Excel you will see an example of a complex number data type that can be operated on as an entity  "=complex(3,4)", although even Excel doesn't manage to conduct calculations on complex numbers.

5. Re: Complex (imaginary) numbers
Michael Hesser Mar 7, 2017 7:54 AM (in response to Martin Dale)Thank you I was mistaken
...and I learned something I never knew about Excel!