Message Boards Message Boards

I need help to understand this part about single random walkers

Posted 9 years ago

I don't understand this part of my code:

initConf = ReplacePart[Table[0, {2 n + 1}, {2 n + 1}], Random[Integer, {1, 4}], {n + 1, n + 1}]

In the book explain that the formula to the system is 2n+1 and that the range of n contain values 1 to 4

POSTED BY: Camilo Pacheco

Hi Camilo,

Maybe this is too late, but anyway,

n=3;
initConf = ReplacePart[Table[0, {2 n + 1}, {2 n + 1}], Random[Integer, {1, 4}], {n + 1, n + 1}]

I played around with your Meander function. It was quite educational.

If you take the Table part:

n=3;
Table[0, {2 n + 1}, {2 n + 1}]//MatrixForm

And execute it, you'll get this:

The table size is {2 n + 1},{2 n + 1}, which is an odd number. The center of the table is at { n + 1},{n + 1} and the ReplacePart is putting a random number right in the center.

ReplacePart[Table[0, {2 n + 1}, {2 n + 1}], Random[Integer, {1, 4}], {n + 1, n + 1}]//MatrixForm

Eric

POSTED BY: Eric Johnstone
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract