MathGroup Archive 2005

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

Search the Archive

Re: Strange bug


Hi,

you have made the error, the last For[] call need a ; at the
end, otherwise it return Null and this is multiplyed with
matx[[rx]] = Table[Max[row[[i]], row[[i + gonl]]], {i, gonl}];

Regards
   Jens

"Steve Gray" <stevebg at adelphia.net> schrieb im Newsbeitrag 
news:crb40r$akl$1 at smc.vnet.net...
>I have procedural function "ordermat." It works ok if the next-to-last 
>(useless) line is there but
> if I remove that one line, I get error messages due to the last line,  at 
> execution time:
>
> Set::write: Tag Times in Null\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
> \[LeftSkeleton]1\
> \[RightSkeleton]} is Protected.
>
> ("intersect" returns a small integer and computes "tafr.")
>
> I've seen bugs like this before. I'm using 5.0.1.0 with Windows. Any 
> clues? Thanks in advance.
>
> Steve Gray
>
>
>
> ordermat[gon_] := Module[{row, rx, cx},
>    gonl = Length[gon];
>    matx = Table[0, {i, 1, gonl}, {j, 1, gonl}];
>    gona = Join[gon, gon];
>    For [ rx = 1, rx <= gonl, rx++,
>      row  = Table[0, {2*gonl}];
>      row[[rx]] = 1;
>      row[[rx + 1]] = 2;
>               ab = gona[[rx]];
>      ae = gona[[rx + 1]];
>      For [ cx = 1, cx <= gonl - 3, cx++,
>                 bb = gona[[cx + rx + 1]];
>                 be = gona[[cx + rx + 2]];
>                 int = intersect[ab, ae, bb, be];
>                 If [ int == 3, row[[cx + rx + 1]] = tafr + 1];
>             ]
>               rx;                  (*   Error unless some expression is 
> here.?? *)
>               matx[[rx]] = Table[Max[row[[i]], row[[i + gonl]]], {i, 
> gonl}];
>           ]
>    ]
> 



  • Prev by Date: Re: Strange bug
  • Next by Date: Re: Help with Matlink, MaMa package
  • Previous by thread: Re: Strange bug
  • Next by thread: NewBie question Plot Table of points from a data file