Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: latest on Mathematica 4 bug

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19034] RE: latest on Mathematica 4 bug
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Tue, 3 Aug 1999 13:45:02 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I have more on the 4.0 bug recently reported by 
(slinger at signal.dera.gov.uk).  The following code gives a simple yet
practical demonstration of the problem.

In[1]:=
ideal={1.5 + 0.2 I, 2.3 + 0.4 I};
output=Fourier[ideal]

Out[2]=
{2.68701 + 0.424264 I, -0.565685 - 0.141421 I}

In[3]:=
Part[output,1]=Part[ideal,1];
output

Out[4]=
{1.5 + 1.5 I, -0.565685 - 0.141421 I}


Of course the first part in Out[4] should be 
(1.5 + 0.2 I)
We all agree this is a bug.
--------------------------------------

As far as I can tell we don't have the problem when ReplacePart is used (as
below).  This solution allows one to keep the advantages of packed arrays,
and I think it's more direct than using Part anyway.
 
 
In[5]:=
output=Fourier[ideal];
ReplacePart[output,ideal,1,1]

Out[6]=
{1.5 + 0.2*I, -0.565686 - 0.141421 I}


In[7]:=
output=Fourier[ideal];
ReplacePart[output, 1.5+0.2I, 1]

Out[8]=
{1.5 + 0.2 I, -0.565685 - 0.141421 I}

-------------------------

We can also use an approach along the lines suggested by WRI Tech Support.
 

In[9]:=
output=Developer`FromPackedArray[Fourier[ideal]];
Part[output,1]=Part[ideal,1];
output

Out[11]=
{1.5 + 0.2 I, -0.565685 - 0.141421 I}


As indicated in an earlier message the error seems to
occur when attempting to set parts of complex, packed arrays.

--------------------------

Regards,
Ted Ersek


  • Prev by Date: International Mathematica Symposium
  • Next by Date: Export Graphics with Brackets
  • Previous by thread: International Mathematica Symposium
  • Next by thread: Export Graphics with Brackets