From: Daniel J S. <dan...@ie...> - 2012-09-07 21:31:04
|
In working with the fftfilt() routine and wanting to know if the inputs were purely imaginary I wondered why there is no such thing as isimag(). It seems as though it would be as useful as or more useful than iscomplex(). Here's the thing: iscomplex() appears to be simply the complement of isreal(), unless I'm missing a more sophisticated use of syntax: octave:5> x = 1 x = 1 octave:6> [isreal(x) iscomplex(x)] ans = 1 0 octave:7> x = i x = 0 + 1i octave:8> [isreal(x) iscomplex(x)] ans = 0 1 octave:9> x = 1+i x = 1 + 1i octave:10> [isreal(x) iscomplex(x)] ans = 0 1 octave:11> I ask, What's the point of having a function that is simply !isreal()? On the other hand isimag(), which is equivalent to "all (real (x) == 0)) && !isreal (x)", would be a nice shorthand. Just an observation. Usually duplication of function (or its complement) is weeded out of programming languages. Dan |