Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

problem with Delete[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58917] problem with Delete[]
  • From: Heath Gerhardt <heathgerhardt at hotmail.com>
  • Date: Sat, 23 Jul 2005 05:32:47 -0400 (EDT)
  • Organization: Department of Computer Science, University of Calgary
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

Delete[] is not removing elements of v in the following function, could 
anyone tell me why?

Rn[N_, p_] := Module[{A, v, c, q, i, j},
     A = Table[0, {i, 1, N}, {j, 1, N}];
     v = Table[i, {i, 2, N}];
     c = 1;
     For[i = 1, i < N, i++,
       j = Random[Integer, {1, Dimensions[v][[1]]}];
       A[[c, v[[j]]]] = 1;
       A[[v[[j]], c]] = 1;
       q = Random[];
       If[q > p, c = v[[j]]];
       Delete[v, j];
       ];
     A
     ]

thanks in advance,
Heath


  • Prev by Date: Re: LegendreP error (bug?) in Mathematica
  • Next by Date: Best style sheet for MS Word looking documents ?
  • Previous by thread: Re: Re: limit problem
  • Next by thread: Best style sheet for MS Word looking documents ?