Re: HELP : Mathematica v4 producing erroneous results ! Mathematica3 worked fine...
- To: mathgroup at smc.vnet.net
- Subject: [mg19000] Re: [mg18954] HELP : Mathematica v4 producing erroneous results ! Mathematica3 worked fine...
- From: "Richard Finley" <rfinley at medicine.umsmed.edu>
- Date: Tue, 3 Aug 1999 13:44:41 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Chris,
yes, I agree with you that it looks like a bug. It must have something to
do with the assignment of output to the Fourier function because inserting
a dummy variable matrix (dufus) works:
In[3]:= output=Fourier[ideal];
dufus = {{0,0},{0,0}}
Do[dufus[[i,j]]=ideal[[i,j]],{i,1,2},{j,1,2}];
output=dufus;
output
Out[3]= {{0.337385+0.6624 I], 0.563615-0.750732 I},{0.869075+0.200504 I,
0.516709+0.938178 I}}
Although that works, of course, it is not very reassuring to not understand
where the error is occuring. If you use Trace the calculation seems to
be acting correctly but then still gives the wrong answer. I hope Wolfram
will give you some kind of an answer....please share it with us. Regards,
RF
>>> Chris Slinger <slinger at signal.dra.hmg.gb> 07/29/99 11:33PM >>>
We recently upgraded to Mathematica v4 on NT and Solaris from Mathematica
v3.
To my horror, I discovered that notebooks which produced good results
under 3 produced
errroneous ones under v4.
I have traced the fault, and the code below is distilled down to illustrate
the
problem. Basically, I'm simply assigning complex numbers to an array
using a
Do[] (but note the Fourier[], which seems to be necessary to cause the
bug, for
some reason). Unfortunately, the imaginary parts of the result are not
correct
- their values should be as in the array "ideal" but are simply equal to
the
real parts !!
Can people reproduce it ? What is going on ? No comments please on style
or
content - remember this is a cut down version of a far larger notebook
just to
illustrate the point:
In[1]:= $Version
Out[1]= "4.0 for Microsoft Windows (April 21, 1999)"
In[2]:= SeedRandom[1];
ideal=Table[Random[Complex,{-1-I,+1+I}],{2},{2}]
Out[2]= {{0.337385+0.6624 I], 0.563615-0.750732 I},{0.869075+0.200504 I,
0.516709+0.938178 I}}
In[3]:= output=Fourier[ideal];
Do[output[[i,j]]=ideal[[i,j]],{i,1,2},{j,1,2}];
output
Out[3]= {{0.337385+0.337385 I, 0.563615+0.563615 I},{0.869075+0.869075
I,
0.516709+0.516709 I}}
Why does Out[3] not equal Out[2] ? In Mathematica v3, there is no
problem.
The upshot of this is that we have "downgraded" back to Mathematica v3
until this is
sorted out (the fragment of code above is distilled from our computer
generated
holography design algorithms).
I've asked Wolfram Support to help out, but am awaiting their comments.
Please e-mail me with any replies as well as copying them to the newsgroup.
Ta,
-chris
slinger at signal.dera.gov.uk