Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to make a Netlogo program a physics model called alternatively Ising model or Spin-glass. Heres a description of the model, using a

Your assignment is to make a Netlogo program a physics model called alternatively Ising model or Spin-glass. Heres a description of the model, using a socio-political scenario:

People start with random political affiliations (Democrat or Republican), and the people are spatially positioned in a grid. Each person has 8 neighbors (including diagonal directions like NW and SE). If a person has more Democratic neighbors than Republican neighbors, then the person buckles under the peer pressure, and becomes Democrat. If a person has more Republican neighbors, they become Republican. If a person has 4 of each kind of neighbor, they stay whatever they were before.

Design a Netlogo simulation for this set of rules. Given this rule set, if you start with the pattern at Time 1, then it should look like the pattern shown in Time 2 after applying the rules once:

image text in transcribed

All of the Democrats are shown by white squares, and all the republicans are shown by black squares.

Hint 1: You dont need to use turtles at all for this simulation; youll only need to worry about patches.

Hint 2: Here is a set up routine you can use to randomly create political affiliations:

Patches-own [party]

to setup

ca

ask patches [ifelse (random 100)

[set party 1] [set party 0]

ifelse party = 1 [set pcolor yellow] [set pcolor blue]]

end

This assumes that you have a slider called density that goes from 0 to 100.

Hint 3: Each patch should own a variable: party. This variable says whether the patch is Democrat (1) or Republican (0). In my program, I also create a temporary variable for each patch, sumz, that contains the sum of the party variables of its neighbors, and accordingly looks like

let sumz (sum [party] of neighbors)

if sumz

Hint 4: Youll definitely want to use the sum command, and youll probably need at least one if or ifelse statement. The whole program will be about 4 lines long.

Question 1: Show your whole Netlogo program

Question 2: Given random configurations with 50% Democrat density, what happens over time? Describe why, as a first pass, this is a reasonable model of how Democrats and Republicans are distributed across the country.

Question 3: Now, allow your patches to assert their individuality. Add some random noise to your simulation - so that even if all of ones neighbors are Democrats, one still could be Republican. So, instead of the statement:

[let sumz (sum [party] of neighbors) if sumz like you probably had earlier, use a command like:

[let sumz (sum [party] of neighbors) + (random randomness) (random randomness)

if sumz

What this code does is it creates a noisy sum of patches that is the actual sum of party states plus a bit of randomness minus a bit of randomness. Youll also need to create a slider called randomness with a range from 0 to about 10. Start with a random configuration with a density of 50%. As you increase randomness (individuality) from 0 to 3, how does the distribution of democrats and republicans change? Do the party regions become larger or smaller as randomness increases? WHY?

Question 4: With randomness set to 2, what happens over time if the initial density of democrats is 56%? Repeat the simulation several times. This behavior is reasonable for some situations, but it doesnt seem like a good behavior for simulating political parties. WHY NOT? You dont have to actually program a new model, but describe how you would change the model to give more realistic behavior.

Time Time 2 Time Time 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions