Services & Resources / Wolfram Forums
MathGroup Archive
*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: Working in Modules

  • To: mathgroup at
  • Subject: [mg15923] Re: Working in Modules
  • From: "Roger Wilson" <roger.wilson at>
  • Date: Wed, 17 Feb 1999 23:33:56 -0500
  • Organization: Nomura International PLC
  • References: <7a2c0d$>
  • Sender: owner-wri-mathgroup at

Init doesn't return the list you think it should because you haven't reset
the value of s.  You've done substitution s /. {0->-1} but this doesn't
change the value of s it just returns a list that you haven't put anywhere
and then returned Partition[s,n].

You need to do s=s/.{0->-1}; inside init 1 instead of just s/.{0->-1};


Dr D McK Paul wrote in message <7a2c0d$1ul at>...
>This is my third attempt to post this question. No idea why it doesnt
>work. I'm not an expert in Mathematica and would appreciate comments on
>why init1 returns a list with all zeros replaced by -1, but init does
>not. Its probably very simple but its confused me.
>                    {s=Table[Random[Integer],{n n}]},
>                    s/.{0->-1};
>                    Partition[s,n]
>                    ]
>                    {s=Table[Random[Integer],{n n}]},
>                    s/.{0->-1}
>                    ]

  • Prev by Date: Re: Coupled Diff Eqn
  • Next by Date: Re: Coupled Diff Eqn
  • Previous by thread: Re: Working in Modules
  • Next by thread: Re: Working in Modules