Get Instant Help From 5000+ Experts For

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

## Equation-based simulations

Types of computer simulation are: • equation-based simulations: these are most commonly used in the physical sciences and other sciences where there is governing theory that can guide the construction of mathematical models based on differential equations. Equation based simulations can either be particle-based, where there are n many discrete bodies and a set of differential equations governing their interaction (e.g. a simulation of a galaxy formation),

they can be field-based, where there is a set of equations governing the time evolution of a continuous medium or field (e.g. a simulation of a fluid). • agent-based (or individual-based) simulations: these are most common in the social and behavioral sciences, though we also find them in such disciplines as artificial life, epidemiology, ecology, and any discipline in which the networked 1 interaction of many individuals is being studied. NetLogo is an example of a language for agent-based simulations.

Agent-based simulations are similar to particle-based simulations in that they represent the behavior of n-many discrete individuals (agents). But unlike equation-particle-based simulations, there are no global differential equations that govern the motions of the individuals. Rather, in agent-based simulations, the behavior of the individuals is dictated by their own local rules. • multiscale simulations: these couple together modeling elements from different scales of description.

A good example of this would be a model that simulates the dynamics of matter as a field undergoing stress and strain but zooms into particular regions of the material where important small scale effects are taking place, and models those smaller regions with relatively more fine-grained modeling methods. Multiscale simulation methods can be further broken down into serial multiscale and parallel multiscale methods. The more traditional method is serial multi-scale modeling. The idea here is to choose a region, simulate it at the lower level of description, summarize the results into a set of parameters digestible by the higher level model, and pass them up to into the part of the algorithm calculating at the higher level.

When the different scales interact strongly to produce the observed behavior, what is required is an approach that simulates each region simultaneously. This is called parallel multiscale modeling. • Monte Carlo simulations: these are computer algorithms that use randomness to calculate the properties of a mathematical model and where the randomness of the algorithm is not a feature of the target model. A nice example is the use of a random algorithm to calculate the value of π. If you draw a unit square on a piece of paper and inscribe a circle in it, and then randomly drop a collection of objects inside the square, the proportion of objects that land in the circle would be roughly equal to π/4.

## Agent-based simulations

A computer simulation that simulated a procedure like that would be called a MC simulation for calculating π. Exercise 1.1 Give brief explanations in your own wording of the different types of simulation illustrated above. Offer cases of experiments that would fit each type of simulation method. 2 NetLogo In NetLogo there are two methods for communicating with the agents: commands and reports. A command is an action that must be performed by the agent, whereas a report calculates a value and returns it.

Commands usually begin with verbs (i.e. 2 actions, such as create , die , jump , inspect , clear , etc.), whereas reports are nouns or phrases that give information on the value obtained (such as distance , sum , max , etc. The commands and reports created in NetLogo are called primitives, whereas those defined by the user for a specific model are usually known by the generic term of procedures. Each procedure is defined by a noun preceded by the keyword to and ending with the keyword end.

In NetLogo it is important to know what type of agents can execute each command. Let’s setup a world with one turtle. Exercise 2.1 Go in the Code tab and type the following: to setup clear-all crt 1 end Click the Check button to verify the syntax is correct. Go to the Interface Tab and type setup in the interactive console under the observer user. What happens?

By default, when a new turtle is created, it is located at the origin of coordinates of the world, but with a random orientation and color. Let’s now make our turtle draw a square of side 4. Exercise 2.2 Go in the Code tab and type the following: to square pd fd 4 rt 90 fd 4 rt 90 fd 4 rt 90 fd 4 end Can you interpret these intuitive commands? The commands pd,pu are respectively for pen down and pen up and are used to let the turtle draw while moving (if pen is down) or moving without drawing (if pen is up.) Click the Check button to verify the syntax is correct. Go to the Interface Tab, select the turtle user and type square in the interactive console. Modify the 3 code above to add one or two additional sides to the polygon.

Create at least 3 different polygons and report the code you have created. You can also use the procedure to square2 pd repeat 4 [ fd 4 rt 90 ] pu end Do you understand the code and what the differences are? Explain. A general procedure is now the following: to polygon [num-sides length-side] pd repeat num-sides [ fd length-side rt (360 / num-sides) ] pu end This is a function that takes two values, one for the number of sides and one for the length of each side. How would you run this procedure? Draw multiple non overlapping polygons by combining this procedure with one for turning the orientation of your turtle.

## Multiscale simulations

Report here the instructions you used. 2.1 Recursion We can now add recursion to this algorithm. We want to combine the repeat procedure above with another parameter for the angle of rotation and the number of times this has to happen. Exercise 2.3 Experiment with the execution of the following code to create figures: to poly-rep [ length-side angle repetitions ] pd repeat repetitions [ fd length-side rt angle] 4 pu end Creat at least three distinct polygons of different length-side, with a different number of sides and different angle. 2.2 If-then Another essential structure to learn is conditional branching.

In NetLogo the possibilities are all variations of the basic schema ifelse condition [ actions-YES ] [ actions-NO ] Exercise 2.4 Experiment with the execution of the following code: to poly-decision [ length-side angle repetitions ] pd repeat repetitions [ fd length-side ifelse ( random 2 = 0 ) [ pd ] [ pu ] rt angle ] pu end What difference does introducing the conditional into this procedure make? Explain the condition, then change it so that if satisfied it turns right by 45 degree, otherwise it turns to the left by 45 degrees. 2.3 Loops In NetLogo loops are defined according to the following easy structure loop [ action ] Exercise .

2.5 Experiment with the execution of the following code: 5 to poly-endless [ length-side angle ] pd loop [ fd length-side rt angle ] pu end What is the difference with the previous procedure? What happens when you run it? Can you change the procedure so that it goes backward for the length of the side of the polygon? To halt the loop you can only use the stop instruction. Exercise 2.6 Modify the above code to include a stop procedure that is enforced if an angle greater than 180 is reached.

2.4 Recursive Calls We can call a procedure inside itself, i.e. construct a recursive procedure. to do-something [ ... ... do-something [ .. ]] Exercise 2.7 Complete the following code to generate a recursive call to poly-recursive [ length-side angle ] pd fd length-side rt angle [...] pu end Modify it further to change the length side and the angle value at each call: for example, use an if condition that stops if the length-side is greater than some value of your choice and at each iteration increases the length side by 0.1 (similarly for the angle value).

6 2.5 While Loops In NetLogo while-loops are defined according to the following easy structure while [ condition ] [ actions ] Exercise 2.8 Write a polygon procedure with length side and angle parameters as above. The procedure write sides of the given length and at the given angle until the angle is less than some degree value. Now modify it to allow the angle to increase by 1 degree at each iteration.

## Equation-based simulations

Main Rules.

1. Each termite starts wandering randomly.
2. If it bumps into a wood chip, it picks the chip up, and continues to wander randomly.
3. When it bumps into another wood chip, it finds a nearby empty space and puts its wood chip down.
4. Summary Of The Rules
1. search-for-chip
2. find-new-pile
3. put-down-chip

Describing the rules informally

On setup, the termites and chips are randomly distributed. A termites searches for a chip and when found it drops the chip in the nearest space or pile found. It then moves on to find another chip. This loops on until there are no chips found separately.

Colours of the turtles and associated operations.

Termites are white when carrying not chip. They turn orange when carrying a chip.The chips are yellow while the background is black.

Changing the colors

Termites are now Pink when carrying not chip.They now turn blue when carrying a chip.The chips are now brown

Exercise 3.4

Main Rules.

1. The fire starts on the left edge of the forest, and spreads to neighboring trees.
2. The fire spreads in four directions: north, east, south, and west.
• The model assumes there is no wind. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire’s motion in that direction.

Running the model for different values of the slider density and note the proportion of the forest that is burned in each case.The lower the density the lower the percentage of the forest burnt.  Thus, when here are many tress, the chances of the fire spreading further becomes higher to.

Hypothesis

When the density of the fire is set to 60. The fire seems to almost always spread out through the forest. Evan then, some trees remain untouched. Setting the density to 59 produced varying results as at times it spread throughout the forest yet other times only consuming a small portion of the forest.

Exercise 3.5

The lower the tolerance, the lower the chances of obtaining mixed groups as men and women become comfortable without people of the opposite sex even though this might mean them staying in “single groups”

Percent tolerance that tends to produce certain percentage of mixing  A low percentage of tolerance produced many groups of singles. It also takes time to complete as people are so unhappy.other Factors affecting the male to female ratio within each group The number of groups available and the people at the party also did affect the ratio.

Types of Simulations NetLogo (Part II) WEEK 18 1 Types Of Simulations And Their Purposes

Exercise 1.1 Brief explanations of the different types of simulation illustrated above.

Agent-Based Simulations

This is also referred to as individual-based simulation as it focuses on representation of behaviors of individuals defined by their own local rules. An example of agent-based simulation is the termites simulation we worked with in part 1.Monte Carlo simulations

This is often used to analyze the risk of an action, attributes or properties that shape the direction of decision making. Matlab’s Simulink supports this kind of simulation.

## Agent-based simulations

Equation-Based Simulations

These sorts of simulation make use of know theoretical concepts to depict the expected behaviors of the objects involved in the simulation in a way that the events would fold out in real life provides similar parameters and conditions. An example of such is the simulation of a pendulum in motion. Multiscale Simulations

Models at various scales are utilized concurrently to represent a system. The various models normally concentrate on diverse scales of resolution. Calculating the speed of a bullet through glycerin is an example of multiscale simulation.

Exercise 2.1 Syntax Check. Go to the Interface Tab and type setup in the interactive console under the observer user. What happens? A cursor-like item pops up on the screen / view space. Content on the screen is also cleared as the screen is set up for use.Exercise 2.2

to square

pd

fd 4

rt 90

fd 4

rt 90

fd 4

rt 90

fd 4

end

Draws a square by placing the pen down, move 4 steps, turn 90% clockwise, repeat 4 steps move, turn another 90% clockwise, move 4 steps, turn 90% clockwise and then move 4 steps to complete the square.

Create at least 3 different polygons

to pent

pd

repeat 5 [

fd 4

rt (360 / 5) ]

pu

end

to hexagon

pd

repeat 6 [

fd 4

rt (360 / 6) ]

pu

end

to oct

pd

repeat 8 [

fd 4

rt (360 / 8) ]

pu

end

Non overlapping polygons by combining this procedure with one for turning the orientation of your turtle.

to poly [num-sides length-side]

pd

repeat num-sides [

fd length-side

rt (360 / num-sides) ]

pu

rt 90

pd

end

Week 19 NetLogo (Part III)  Exercise 1.1

Computer simulation to answer questions about how these events could possibly have occurred; or about how those events actually did occur.Exercise 2.1

1. We investigate a bunch of eating turtles
2. In the model one turtle has all the food
3. The turtles are spread randomly in the world and they move randomly
4. When a turtle meets a turtle with food, it receives some and eats
5. The difference between turtles with and without food is by coloring
6. At the end, all turtles have food

Exercise 2.2

1. Yes, each user in the community received at the message upon being close/nearby in relation to the user who already has the message.The more users within a given area, the more likely that the message will spread to all the users.

It takes longer when the number of users is less in that area distance between user becomes wider hence taking longer to reach out to everyone. Even in large community of users, the message still gets passed to all users.Yes. the length of the program execution at termination is proportional to the size of the community. However, with every few users in a vast area, it would at times take long to reach out to every user.

Exercise 2.3 Yes, each user in the community received at least one of the two messages.

1. The more users within a given area, the more likely that the message will spread to all the users.

## Multiscale simulations

It takes longer when the number of users is less in that area distance between user becomes wider hence taking longer to reach out to everyone. Even in large community of users, the message still gets passed to all users

4.Yes. When there is no lecture, e.g during a public holiday, all user would get a not-message1.

1. Yes. the length of the program execution at termination is proportional to the

size of the community. However, with every few users in a vast area, it would at times take long to reach out to every user.

turtles-own [

message?  ;; true or false: has this turtle gotten the message yet?

to setup

clear-all

create-turtles 300 [

set message? false

setxy random-xcor random-ycor

set size 2

]

set message? true  ;; give the message to one of the turtles

]

recolor  ;; color the turtles according to whether they have the message

]

reset-ticks

end

to go

if all? turtles [ message? ] [ stop ]

tick

end

;; the core procedure!

to communicate  ;; turtle procedure

if any? link-neighbors with [ message? ]

[ set message? true ]

end

;; color turtles with message red, and those without message blue

to recolor  ;; turtle procedure

ifelse message?

[ set color red ]

[ set color blue ]

end

Simulations and Experiments Week 20

Exercise 1.1

The Security for the data being transmitted has not been given any consideration. The Various lectures that exist and the fact that users might not be taking similar lectures. Elements and relations that represent the simulation differ in material with physically real objects.

Exercise 1.2

Isomorphism: every property, element or relation of the real-world situation is mapped to a formal property in the simulation;

Exercise 1.3

Security for the data being transmitted.

The Various lectures that exist and the fact that users might not be taking similar lectures.

Elements and relations that represent the simulation differ in material with physically real objects.

Exercise 2.1

Switch messages occurs as a message from one agent does not affect reception of the other agent as before.Yes

1. Not affected by community sizes
2. Any Size of community
3. when there are two users
4. Yes.
5. When no message has been received from an agent.
6. Security and availability of the agents and messages being sent.

Network Structures Week 21 Exercise 2.1

A graph G is an ordered triple G := {V, E, f }

A graph G = (V, E) is planar if it can be “drawn” on the plane without edges crossing except at endpoints. Example: G= {3,6,f:(x^2)} : has 3 vertices and 6 edges

Exercise 2.2

A connected graph is one with any of its nodes reachable from any other node following a sequence of edges or with any of its two nodes are connected by a path. To reach two non adjacent nodes from each other we have to have at least 7 edges

Exercise 2.3

A connected graph is one with any of its nodes reachable from any other node following a sequence of edges or with any of its two nodes are connected by a path. To reach two non adjacent nodes from each other we have to have at least 7 edges. G= {4,7,f:(x^2)}Exercise 2.4

A directed graph is strongly connected if there is a directed path from any node to any other node.

The degree of a node is the number of edges that are linked to it.

In a directed graph we count the number of edges  entering

(in-degree) and the number of edges leaving (out-degree)  then sum those. Degrees

G= {3,6,f:(x^2)} : Max degree = 3+4=7

Exercise 2.5

A k-length walk in a graph is a succession of k edges, where the second node of each edge is the first node in the following edge of the walk.

Exercise 2.6

Path is a walk in which all the edges and all nodes differ.

Exercise 2.7

A cycle is a closed path in which all edges are different.

Exercise 2.8

The total graph T (G) of a graph G is a graph with the following criteria

• V (T (G)) corresponds to V (G) ∪ E(G)
• two vertices are adjacent in T (G) if and only if their corresponding elements

are either adjacent or incident in G.

Exercise 4.1

1. The model does distribute the two messages in equivalent proportions. Random network affects the proportion by varying the output proportion in each execution even when other parameters are kept unchanged
1. Yes. They all have nodes and capable of passing data from one node to another.
1. The more liars are in the model, the higher the proportion of liars yielded.
1. When the Liars slider is set to to 100%.
Cite This Work

My Assignment Help. (2020). Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.. Retrieved from https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

"Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.." My Assignment Help, 2020, https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

My Assignment Help (2020) Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations. [Online]. Available from: https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing
[Accessed 21 July 2024].

My Assignment Help. 'Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations.' (My Assignment Help, 2020) <https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing> accessed 21 July 2024.

My Assignment Help. Types Of Computer Simulations And NetLogo Programming For Agent-Based Essay Simulations. [Internet]. My Assignment Help. 2020 [cited 21 July 2024]. Available from: https://myassignmenthelp.com/free-samples/csd-3203-history-and-philosophy-of-computing.

Get instant help from 5000+ experts for

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost