[Scilab-users] Is this behavior of ifft / isreal correct?

Stefan Du Rietz sdr at durietz.se
Thu Apr 7 09:18:19 CEST 2022


Hello Federico,

--> isreal(%i^2, %eps)
  ans  =
   T

--> %i^2 == -1
  ans  =
   T

Regards
Stefan


On 2022-04-07 05:24, Federico Miyara wrote:
> 
> Dear all,
> 
> Consider
> 
> M = 16
> w = [ones(1,M/4),zeros(1,M/4)]
> w = [w(1:M/2), 0, conj(w($:-1:2))]
> v = ifft(w)
> isreal(v)
> 
> The first 3 lines defines a real spectrum of a real signal, then the 
> real signal is recovered and finally it is checked whether it is real or 
> not.
> 
> What puzzles me is that the result is T (true). However, the definition 
> of the ifft() involves complex operations, so at some point the numbers 
> must be converted to a complex representation such as
> 
> 1. + 0.i
> 
> so I would expect that the result included 0i so the result of the test 
> should be F. Where is this null imaginary component removed?
> 
> I don't say this is wrong, but it is perplexing if compared to much more 
> simple operations such as
> 
> sqrt(%i^4)
> 
> which yields 1. + 0.i, a complex representation of real scalar 1.
> 
> Maybe the fftw package is so refined to detect whether the result is 
> actually real and removes the useless 0.i components?
> 
> Regards,
> 
> Federico Miyara
> 
> 
> 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
> 	Libre de virus. www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
> 
> 
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list