I've now built 4.6.1alpha0, and this is what I get: sage: import scipy.fftpack as Fourier sage: Fourier.ifft([95,20-25*i,-23,20+25*i]) ... ValueError: setting an array element with a sequence.
sage: Fourier.ifft([95,20,-23,20]) array([ 28.0+0.j, 29.5-0.j, 8.0+0.j, 29.5+0.j]) sage: Fourier.ifft([95,20-25*j,-23,20+25*j]) ... NameError: name 'j' is not defined sage: Fourier.ifft([95,20-25j,-23,20+25j]) array([ 28.+0.j, 42.+0.j, 8.+0.j, 17.+0.j]) sage: Fourier.ifft([95,20-25i,-23,20+25i]) ... SyntaxError: invalid syntax So it now raises an error rather than silently ignoring the I. Not as convenient as it could be, but at least it doesn't give you an incorrect answer! Cheers, Felix On Nov 4, 11:57 pm, kcrisman <kcris...@gmail.com> wrote: > On Nov 3, 10:41 pm, Felix Lawrence <fe...@physics.usyd.edu.au> wrote: > > > Here's why there's a discrepancy: > > sage: import scipy.fftpack as Fourier > > sage: Fourier.ifft([95,20-25*i,-23,20+25*i]) > > array([ 28.0+0.j, 29.5-0.j, 8.0+0.j, 29.5+0.j]) > > sage: Fourier.ifft([95,20,-23,20]) > > array([ 28.0+0.j, 29.5-0.j, 8.0+0.j, 29.5+0.j]) > > sage: sage: Fourier.ifft([95,20-25j,-23,20+25j]) > > array([ 28.+0.j, 42.+0.j, 8.+0.j, 17.+0.j]) > > > I encountered a similar bug in numpy last week when using > > numpy.loadtxt - any terms involving 'I' were ignored. I think it's an > > upstream problem. In my case I could get around it since loadtxt > > accepts a list of converters, and you send it this one: > > lambda s: complex(s.replace('i','j')) > > I see - that makes sense, since numpy is a Python thing we don't need > an interface per se, and so it only accepts 'legitimate' Python > complex numbers. I'm just surprised it doesn't throw an error in that > case! I'm not sure upstream would say it's a problem - do you mind > asking the numpy list about this? I am not exactly a numerical guy, > and would probably ask the wrong question :) > > > Does anyone know if this is fixed in newer versions of numpy/scipy? > > I bet someone could test this if they've already built 4.6.1.alpha0 ! > Volunteers? > > - kcrisman -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org