Workshop materials / Материjали семинара
Foxes_and_Rabbits_4.ipynb <-- v.2024-04-30, still not working
Homework: fix the code
And then did the same, only using Object-Oriented Programming.
Foxes_and_Rabbits_3.ipynb <-- v.2024-04-23, not working
The participants created a code modeling random fox and random hostile rabbit, this time using objects, and observed the pursuit duration depending on the field size.
Foxes_and_Rabbits_2.ipynb <-- v.2024-04-16, working
Homework:
1) Create the graph for median depending on the field size.
2) Currently the fox and the rabbit are spawned in two random positions on the map. Create the following graphs:
2.1) The baseline as ^ (with average as red point and median as green point), keep a single experiment as a blue point.
2.2) Do the "regular spawn". Spawn rabbit in the (0,0) and the fox in the (N//2, N//2) cell. Not randomly.
Draw the graphs.
Draw the barcharts that represent the Variance of the experiment value for the "random spawn" vs "regular spawn".
3) Create the animation that takes the trajectory as a parameter to the Constructor and shows it either on the screen or saved into the .avi file.
Animation should also be a class
class Animation:
def __init__(self, game: Game):
...
4*) Bonus problem: write your outcome as a "scientific report".
The participants created a code modeling random fox and random hostile rabbit.
From the instructor: "Next time I intend to get to graphs and interpolated results. The participants need to be able to predict results that they can't get directly, because it takes too long to make all the calculations."
Sounds interesting :)
We discussed the difficulties (and how to overcome them) of presenting one's work and results
We discussed the Game of Life Wars.
Homework:
Find the bug in the GoL_Wars code and fix it
Design an algorithm (a function) for blue or red cells.
A cell could be in one of the six states:
0 empty
1 normal
2 blue special
3 lightblue (blue warrior)
4 red special
5 pink (red warrior)
Blue and red warriors are spawned if at least one of their 3 parents is colored to the corresponding color.
If there are 2 different colors, warrior is not spawned
If 2 warrior neighbors of different colors they both disappear
Selection problem 2 for SIMC
Given a square grid 100x100. A random population is introduced at time t=0 and for t≥0 satisfies the standard GoL dynamics:
any live cell with less than two live neighbors dies, as if by underpopulation;
any live cell with two or three live neighbors lives on to the next generation;
any live cell with more than three live neighbors dies, as if by overpopulation;
any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
There are also "special cells" that behave in the following manner:
each time step one special cells appears in random location;
every special cell lives for exactly K ticks, then dies;
special cell, whenever applicable, serves as a "neighbor" of the normal cell, so a given cell could be born, survive or die.
The task is:
animate this GoL for K = 10 .. 100
create the graph for the stable* population depending on K and explain it
* S = "stable population" is the average number of alive "non-special" cells in the tick range [500,699]
Example of an animation:
You can use the code of standard GoL.
Please provide:
the notebook (.ipynb) with comments
animation video
graph S(K)
explanation of everything observed
deadline: 18:00 CET 12/03/2024
We discussed the Romberg method.
Homework:
Find the bug in the Interpolation code and fix it
* Measure how faster Romberg method is in achieving the same accuracy
Selection problem 1 for SIMC
This problem needs to be solved numerically.
Please provide a notebook with a picture.
The gun shoots at the target:
Coordinates of the target
X (distance) = 16.5 m 2500 m,
Z (height) = 4.5 m 65 m
Cannon ball (initial) speed V = 300 m/s
Gravity acceleration 9.81m/s^2
Cannon core mass 30 kg 25 kg
Drag coefficient D = 0.025 kg/m
The friction force is directed in the opposite direction to the speed and depends on the speed module as follows: Drag_Force = 0.5*V+0.09*V*V D*v*v.
At what angle(s?) should one shoot to hit the target?
Give the angle value in degrees up to 3 correct digits.
Solve numerically and show .ipynb and a picture like this ⟶
due date: March 5th, 2024
We discussed adding the second predator to GOL, the Lotka-Volterra model, the buggy cannonball model.
Homework:
Find the bug in the Buggy Cannonball code and fix it
Add a third predator to GOL, which depends on the second one, start the animation, build graphs, analyze them
important-1: leave explaining comments in the code
important-2: the work and conclusions should be explained in written form
We discussed the Game of Life and the Lotka-Volterra Model.
Files:
Lotka-Volterra toy example.ipynb
Homework (optional):
1️⃣ Try to create another species on the land (of level "2") and set the rules:
For level1 smth like "B23S234567"
B -- is the predicate of birth if number of living neighbors of level 1 is...
S -- is the predicate of survival, if number of living neighbors of level 1 is ...
D -- predicate of birth of level2, if number of living cells of level 1 is ...
E -- predicate of survival of level2, if number of living cells of level 1 is ...
level2 overrides level1
🅱️#1: add "carnivorous (predator)" of level 2:
F, G (birth, survival) -- depend on the number of living neighbors regardless of their level
color them into 3 different colors, and draw the survival curves on the same graph
🅱️#2: try to create the rules that perform a long-term dynamics, periodical function with a period of ~50 generations
2️⃣ Include predator #2 to the system
OR
---- ---- ---- ----
We discussed the Game of Life, but due to some connection troubles couldn't get to the most interesting part -- where we use machine learning to predict the behavior of the system.