Professional Documents
Culture Documents
Biology Extra IA 6.14.22
Biology Extra IA 6.14.22
Possible Ideas
- Magnetotactic Bacteria
- Impact of magnetic fields on insects
- The effects of removing Cane Toads
- Biological methods of plant protection.
- Evolution of Invertebrate symmetry/Asymmetry
- Simulating community ecology with computer models
- Natural Selection modelled with a computer simulation
- The maths behind population Curves
- Evolutionary Game theory with its links to computer science
Code
from numpy import *
from pyqtgraph import PlotWidget, plot
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon, QPixmap
import math
class Ui_MainWindow(object):
global rvalue
global pvalue
global kvalue
def prey(self):
self.graphicsView.clear()
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23]
b = sin(a)
c = sin(a)+1
def generate_graph(self):
pValue = int(self.tempSlider.value())
kvalue = int(self.litterSlider.value())
Shay Brokensha - 2022
rvalue = int(self.foodSlider.value())
rValue = rvalue/100
kValue = kvalue/100
#rValue = -rVAlue
self.graphicsView.clear()
a = rValue*(kValue/(1+(2.7)**(-0+5)))+pValue
b = rValue*(kValue/(1+(2.7)**(-1+5)))+pValue
c = rValue*(kValue/(1+(2.7)**(-2+5)))+pValue
d = rValue*(kValue/(1+(2.7)**(-3+5)))+pValue
e = rValue*(kValue/(1+(2.7)**(-4+5)))+pValue
f = rValue*(kValue/(1+(2.7)**(-5+5)))+pValue
g = rValue*(kValue/(1+(2.7)**(-6+5)))+pValue
h = rValue*(kValue/(1+(2.7)**(-7+5)))+pValue
i = rValue*(kValue/(1+(2.7)**(-8+5)))+pValue
j = rValue*(kValue/(1+(2.7)**(-9+5)))+pValue
k = rValue*(kValue/(1+(2.7)**(-10+5)))+pValue
l = rValue*(kValue/(1+(2.7)**(-11+5)))+pValue
m = rValue*(kValue/(1+(2.7)**(-12+5)))+pValue
n = rValue*(kValue/(1+(2.7)**(-13+5)))+pValue
o = rValue*(kValue/(1+(2.7)**(-14+5)))+pValue
p = rValue*(kValue/(1+(2.7)**(-15+5)))+pValue
q = rValue*(kValue/(1+(2.7)**(-16+5)))+pValue
r = rValue*(kValue/(1+(2.7)**(-17+5)))+pValue
s = rValue*(kValue/(1+(2.7)**(-18+5)))+pValue
t = rValue*(kValue/(1+(2.7)**(-19+5)))+pValue
u = rValue*(kValue/(1+(2.7)**(-20+5)))+pValue
y = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r,
s, t, u]
x = range(0, 21)
line1 = self.graphicsView.plot(x, y, pen='g', symbol='x',
symbolPen='g', symbolBrush=0.2, name='green')
# self.graphWidget = pg.PlotWidget()
# # self.setCentralWidget(self.graphWidget)
# # # self.graphWidget.setGeometry(QtCore.QRect(490,
100, 471, 450))
# # hour = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# # temperature = [30, 32, 34, 32, 33, 31, 29, 32, 35,
45]
# # # plot data: x, y values
# # self.graphWidget.plot(hour, temperature)
def pChanged(self):
global rvalue
global pvalue
global kvalue
pValue = str(self.tempSlider.value())
self.pNumLabel.setText(pValue)
Shay Brokensha - 2022
def kChanged(self):
global rvalue
global pvalue
global kvalue
kValue = str(self.litterSlider.value())
self.kNumLabel.setText(kValue)
def rChanged(self):
global rvalue
global pvalue
global kvalue
rValue = str(self.foodSlider.value())
self.rNumLabel.setText(rValue)
self.litterSlider.setTickPosition(QtWidgets.QSlider.TicksAbove)
self.litterSlider.setTickInterval(1000)
self.litterSlider.setObjectName("litterSlider")
self.tempSlider = QtWidgets.QSlider(self.centralwidget)
self.tempSlider.setGeometry(QtCore.QRect(230, 105, 160, 22))
self.tempSlider.setMinimum(1)
self.tempSlider.setMaximum(10)
self.tempSlider.setOrientation(QtCore.Qt.Horizontal)
self.tempSlider.setInvertedControls(False)
self.tempSlider.setTickPosition(QtWidgets.QSlider.TicksAbove)
self.tempSlider.setTickInterval(200)
self.tempSlider.setObjectName("tempSlider")
self.foodSlider = QtWidgets.QSlider(self.centralwidget)
self.foodSlider.setGeometry(QtCore.QRect(230, 225, 160, 22))
self.foodSlider.setMinimum(0)
Shay Brokensha - 2022
self.foodSlider.setMaximum(200)
self.foodSlider.setSingleStep(5)
self.foodSlider.setOrientation(QtCore.Qt.Horizontal)
self.foodSlider.setTickPosition(QtWidgets.QSlider.TicksAbove)
self.foodSlider.setTickInterval(10)
self.foodSlider.setObjectName("foodSlider")
self.shayLabel = QtWidgets.QLabel(self.centralwidget)
self.shayLabel.setGeometry(QtCore.QRect(20, 520, 191, 16))
self.shayLabel.setObjectName("shayLabel")
self.pLabel = QtWidgets.QLabel(self.centralwidget)
self.pLabel.setGeometry(QtCore.QRect(20, 100, 211, 31))
font = QtGui.QFont()
font.setPointSize(12)
self.pLabel.setFont(font)
self.pLabel.setObjectName("pLabel")
self.kLabel = QtWidgets.QLabel(self.centralwidget)
self.kLabel.setGeometry(QtCore.QRect(20, 160, 191, 31))
font = QtGui.QFont()
font.setPointSize(12)
self.kLabel.setFont(font)
self.kLabel.setObjectName("kLabel")
self.rLabel = QtWidgets.QLabel(self.centralwidget)
self.rLabel.setGeometry(QtCore.QRect(20, 220, 181, 31))
font = QtGui.QFont()
font.setPointSize(12)
self.rLabel.setFont(font)
self.rLabel.setObjectName("rLabel")
self.graphButton = QtWidgets.QPushButton(self.centralwidget,
clicked=lambda: self.generate_graph())
self.graphButton.setGeometry(QtCore.QRect(230, 450, 200,
41))
font = QtGui.QFont()
font.setPointSize(13)
self.graphButton.setFont(font)
self.graphButton.setObjectName("graphButton")
self.preyButton = QtWidgets.QPushButton(self.centralwidget,
clicked=lambda: self.prey())
self.preyButton.setGeometry(QtCore.QRect(230, 510, 200, 41))
font = QtGui.QFont()
font.setPointSize(13)
self.preyButton.setFont(font)
self.preyButton.setObjectName("preyButton")
self.pNumLabel = QtWidgets.QLabel(self.centralwidget)
self.pNumLabel.setGeometry(QtCore.QRect(410, 100, 40, 30))
font = QtGui.QFont()
font.setPointSize(11)
self.pNumLabel.setFont(font)
self.pNumLabel.setObjectName("pNumLabel")
self.kNumLabel = QtWidgets.QLabel(self.centralwidget)
self.kNumLabel.setGeometry(QtCore.QRect(410, 160, 50, 30))
font = QtGui.QFont()
font.setPointSize(11)
Shay Brokensha - 2022
self.kNumLabel.setFont(font)
self.kNumLabel.setObjectName("kNumLabel")
self.rNumLabel = QtWidgets.QLabel(self.centralwidget)
self.rNumLabel.setGeometry(QtCore.QRect(410, 220, 40, 30))
font = QtGui.QFont()
font.setPointSize(11)
self.rNumLabel.setFont(font)
self.rNumLabel.setObjectName("rNumLabel")
self.graphicsView = PlotWidget(self.centralwidget)
self.graphicsView.setGeometry(QtCore.QRect(490, 100, 471,
450))
self.graphicsView.setObjectName("graphicsView")
self.image = QtWidgets.QLabel(self.centralwidget)
self.image.setGeometry(QtCore.QRect(80, 300, 321, 131))
self.image.setText("")
self.image.setObjectName("image")
pixmap = QPixmap('equation.gif')
self.image.setPixmap(pixmap)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.tempSlider.valueChanged.connect(self.pChanged)
self.litterSlider.valueChanged.connect(self.kChanged)
self.foodSlider.valueChanged.connect(self.rChanged)
if __name__ == "__main__":
import sys
Shay Brokensha - 2022
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Background Research
1. What is Population Ecology?
- Deals with species populations.
- E.g., Emigration, immigration, mortality, and natality
- It can predict whether that specie will live (and thrive) in that particular habitat that
it is in
- A population is the number of organisms of the same species that live in a particular
geographic area at the same time, with the capability of interbreeding.
- The total number of individuals in a population is defined as population size.
- Population size of any given specie can fluctuate drastically depending on a range of
biotic and abiotic factors
Definitions
- Reproductive potential
- Limiting factors
- Emigration
- Natality
- Predation
- Carrying capacity
Term Definition
Reproductive The Reproductive potential is the relative capacity of the
Potential population to reproduce under optimal conditions
Limiting Factors Any factor that directly affects a habitats carrying
capacity when its quantity is changed
Emigration The act of leaving one’s own habitat
Natality The birth rate within a competition
Predation A biological interaction where one organism (the
predator), eats another organism (the prey)
Carrying The number of organisms which can survive with the
Capacity available number of resources within an ecosystem
Personal Relationship
When I first was shown how the population dynamics of a
predator/prey relationship worked I was captivated with how both
the populations can vary in magnitude and remain stable with
killing out one or the other. I believe this factor was what made me
make a simulation about population trends.
Background Information
While my topic is very broad and covers a range of different
disciplines, only a few prerequisites need to be learnt to fully
understand it.
Predator Prey
A Predator Prey relationship is the relationship shared
between both predator and prey. A predator is known as an
animal that eats prey. And the prey is the creature being
eaten. Given this scenario certain patterns emerge between
the two species.
Carrying Capacity
The carrying capacity is known as the number of organisms
an ecosystem can sustain long-term.
Shay Brokensha - 2022
Quadratics
Quadratics is a field of maths in which an equation can be
made and then graphed given a particular shape.
Communication Medium
As said above I really have a love for both programming and maths
hence I was willing to combine all three topics together to
accomplish the simulation. While choosing the topic I also
considered building a model, however I couldn’t think of an
interactive fun way I could build a model on population trends. I
also don’t think that a collection would have been the best idea
either with the key question being; what would I collect?
I really like the idea of a PowerPoint. As mentioned, several times
I have a knack for computers and could put one together without
much struggle. Again, I thought about a video and a poster
however I thought that I didn’t want to go to the hassle of writing,
filming and then editing a video, hence I chose a PowerPoint
References
https://www.wolframalpha.com/input?i=1%2F2+%28sin%28x+%CF%80+-+
%CF%80%2F2%29+%2B+1%29&assumption=%22ClashPrefs%22+-%3E+
%7B%22Math%22%7D
https://biologydictionary.net/population/
https://en.wikipedia.org/wiki/Evolutionary_game_theory#:~:text=Evolutionar
y%20game%20theory%20encompasses%20Darwinian%20evolution%2C
%20including%20competition
Lakna. (2019, December 13). What is the Difference Between Biotic Potential and
%20reproductive%20potential%20is%20the%20relative%20capacity%20of
python 3.x - TypeError: unsupported operand type(s) for ^: “float” and “int.” (n.d.).
https://stackoverflow.com/questions/66701388/typeerror-unsupported-
operand-types-for-float-and-int
https://realpython.com/simpy-simulating-with-python/#:~:text=%20To
%20recap%2C%20here%20are%20the%20three%20steps
https://www.desmos.com/calculator/kn9tpwdan5
https://www.desmos.com/calculator/5cljvgire7
https://math.stackexchange.com/questions/459872/adjustable-sigmoid-curve-
s-curve-from-0-0-to-1-1
University Press.
Trading 101 | How to Use Game Theory to Your Advantage in Business. (n.d.).
https://www.trading101.com/blog/how-to-use-game-theory-to-your-
advantage-in-business#:~:text=The%20most%20common%20example%20of
%20game%20theory%20usage
Www.onlinemathlearning.com.
https://www.onlinemathlearning.com/transformation-linear-functions.html
Foundation. https://en.wikipedia.org/wiki/Kin_selection
Journal
STUDENT NAME Shay Brokensha
6/14/2022 Today I was first informed about the competition. I instantly read 0.5
the competition manual and guidelines. I then set to work
shortlisting a bunch of possible research ideas.
6/17/2022 Today I found the ideal software which I was going to use 0.5
(Python). I then started researching and doing some background
research so I can start planning the coding aspect
6/20/2022 Today I was able to find a module to use to code the simulation. I 0.5
then started looking up some tutorials to aid in my learning of
this new module.
6/21/2022 Again, today I was just doing some background research to put 2.5
on my poster and for my essay. I then started coding the
simulation.
7/21/2022 Today I fixed some bugs in my program and then added to it a bit 2
more
7/19/2022 Today I fixed some more bugs and was then able to code some 1
more.