Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Significant digits and complex numbers

Status
Not open for further replies.

kraigb

Electrical
Jul 11, 2000
42
0
0
US
I am running into some difficulty formatting the numbers that come out of manipulation of complex numbers. In order to do the mathematical computations, I have to break a complex number down to do operations on the imaginary and real components separately.
When I return to complex notation, the number of significant digits is untenable. I cannot get any of the built in number formats to change the way the number is displayed.
For information, I am starting with a number like:
3E-002+3.6E-002i which is displayed using the formula: =COMPLEX(0.03,0.036,"j")
In order to do unit conversion on these numbers, however, I am using the formula:
=COMPLEX((IMREAL(B22)*5.28/C17),IMAGINARY(B22)*5.28/C17,"j")
this is where I get the insane number of significant digits.
How can I bring the results down to 2 or 3 significant digits?
Any suggestions on how to better handle complex numbers would also be appreciated.
Thanks!
 
Replies continue below

Recommended for you

Have you tried the custom formatting? Sometimes this seems to do just fine and other times its off. Just checking to see what you've done.
 
Looks like Excel.

I've just spent 10 minutes messing about with it, and the only approach I can see that seems to have a chance is to write your own display function, separate from the actual calculated result.

The complex number you want to format is in c23

d23=IMREAL(C23)
d24=imaginary(c23)
d25=text(d23,"0.00")&"+"&text(d24,"0.00")&"j"

Then you can hide the original result (c23, d23,d24 in this case).

Very ugly!



Cheers

Greg Locock
 
Another alternative is to cut down significant digits by using one of the ROUND functions during your unit conversion process: of course you will lose precision for any subsequent calculations, but if you can accept this...
By the way, I have no complex handling functions in my Excel 2000 installation: is this an add-on or what?
prex
motori@xcalcsREMOVE.com
Online tools for structural design
 
Thanks, everyone. Yes, as GregLocock surmised, it is Excel that I am using. Sorry about my omission.

For Prex: You are correct. The complex number functions are included in the Analysis Toolpak Add-in.

I just tried the custom formatting, and Excel seems to ignore that.
I will give these suggestions a shot. The intermediate formatting step may work, but I will also try writing a VB function and see if I can control the variable type that I pass back out.
Thanks for the advice, and I will give feedback when I get the chance to try these hints.
Regards,
Kraigb
 
Well, I have taken some time to mess with this some more, and the least painful method is the text conversion method that Greg Locock proposed. As Greg mentioned, though, the actual caculations need to happen in some other hidden cells, but this does provide a formatted output that is a little more aesthetically pleasing.
Thanks to all for their suggestions and responses on this!
Kraigb
 
Status
Not open for further replies.
Back
Top