Complex number

Hi, there. I ran into a very strange problem. I got some numbers which look like real number. When I print them, they don't have imaginary part. But when I square these numbers, then they show imaginary parts. I'm completely confused and have no clue what's going on with these numbers.

Thanks.

1 Answer



0



These numbers are actually complex, but with an imaginary portion of zero. When you print them, you may notice that the spacing between columns is a little larger than normal, because GAUSS prints imaginary numbers with enough room for the imaginary portion, but suppresses the display of any particular imaginary portion that happens to be exactly zero.

You can check to see if a GAUSS variable is complex by using the function iscplx. For example, if the GAUSS variable in question is 'my_data':

ret = iscplx(my_data);

You can further check to see if a variable has a non-zero imaginary portion with the function hasimag. hasimag will return 0 if you data is complex, but the complex portion is zero.

ret = hasimag(my_data);

aptech

1,773

Your Answer

1 Answer

0

These numbers are actually complex, but with an imaginary portion of zero. When you print them, you may notice that the spacing between columns is a little larger than normal, because GAUSS prints imaginary numbers with enough room for the imaginary portion, but suppresses the display of any particular imaginary portion that happens to be exactly zero.

You can check to see if a GAUSS variable is complex by using the function iscplx. For example, if the GAUSS variable in question is 'my_data':

ret = iscplx(my_data);

You can further check to see if a variable has a non-zero imaginary portion with the function hasimag. hasimag will return 0 if you data is complex, but the complex portion is zero.

ret = hasimag(my_data);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy