{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Introdução à Evolução\n",
"## Seleção natural\n",
"Seleção natural é o fenômeno relacionado com a diferença na capacidade de diferentes indivíduos de formar descendentes, ou seja, crescer. Esta diferença decorre do efeito do ambiente sobre os indivíduos, cada qual com seu grau de adaptação. Esta capacidade de reprodução também representada pela taxa de reprodução, em modelos evolutivos, Corresponde ao grau de adaptação do indívíduo ao seu ambiente e é chamada de **Fitness**.\n",
"\n",
"Para modelar os efeitos da seleção natural, precisamos de pelo menos dois \"tipos\" de indivíduos. Vamos chamá-los de A e B. Denotaremos o fitness de A por $a$ e o de B por $b$. Seja $x(t)$ o número de indivúduos do tipo A no tempo $t$ e $y(t)$ o número de indivíduos do tipo B no tempo $t$. Sejam ainda $x_0$ e $y_0$ os números de A e B no tempo $t=0$.\n",
"\n",
"Cujas soluções são:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2021-10-04T12:44:53.812522Z",
"start_time": "2021-10-04T12:44:53.802794Z"
}
},
"outputs": [],
"source": [
"%display typeset"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2021-09-29T12:18:56.221188Z",
"start_time": "2021-09-29T12:18:54.497055Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{\\partial}{\\partial t}x\\left(t\\right) = a x\\left(t\\right)$$"
],
"text/plain": [
"diff(x(t), t) == a*x(t)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{\\partial}{\\partial t}y\\left(t\\right) = b y\\left(t\\right)$$"
],
"text/plain": [
"diff(y(t), t) == b*y(t)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}x_{0} e^{\\left(a t\\right)}$$"
],
"text/plain": [
"x_0*e^(a*t)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}y_{0} e^{\\left(b t\\right)}$$"
],
"text/plain": [
"y_0*e^(b*t)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{\\frac{\\partial}{\\partial t}x\\left(t\\right)}{\\frac{\\partial}{\\partial t}y\\left(t\\right)} = \\frac{a x\\left(t\\right)}{b y\\left(t\\right)}$$"
],
"text/plain": [
"diff(x(t), t)/diff(y(t), t) == a*x(t)/(b*y(t))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var(\"x x_0 y_0 a b y t\")\n",
"x = function('x')(t)\n",
"y = function('y')(t)\n",
"xdot = diff(x,t)==a*x\n",
"ydot = diff(y,t)==b*y\n",
"show(xdot)\n",
"show(ydot)\n",
"solx = desolve(xdot,x, ics=[x_0], ivar=t)\n",
"soly = desolve(ydot,y, ics=[y_0], ivar=t)\n",
"show(solx.subs(_C=x_0))\n",
"show(soly.subs(_C=y_0))\n",
"xdot/ydot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Seja $t=τ$ o tempo até que a população A dobre de tamanho, é fácil encontrar que $τ=log_2 /a$. De maneira similar, B leva $log_2 /b$ para dobrar de tamanho."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2021-09-29T12:42:02.388570Z",
"start_time": "2021-09-29T12:42:02.373923Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left[\\tau = \\frac{\\log\\left(2\\right)}{a}\\right]$$"
],
"text/plain": [
"[tau == log(2)/a]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var('tau')\n",
"f = x_0*exp(a*tau)==2*x_0\n",
"solve(f,tau)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Seja a razão entre as duas populações: $ρ(t)=x(t)/y(t)$. Logo temos a seguinte equação diferencial\n",
"\n",
"$$\\dot{ρ}=\\frac{\\dot{x}y−x\\dot{y}}{y^2}=(a−b)ρ,$$\n",
"onde $\\dot{\\rho}=\\frac{d\\rho}{dt}$. Abaixo temos a derivação de $\\dot{ρ}$ usando o sage:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2021-09-29T12:44:06.805958Z",
"start_time": "2021-09-29T12:44:06.703634Z"
}
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{\\partial}{\\partial t}\\rho\\left(t\\right) = \\frac{y\\left(t\\right) \\frac{\\partial}{\\partial t}x\\left(t\\right) - x\\left(t\\right) \\frac{\\partial}{\\partial t}y\\left(t\\right)}{y\\left(t\\right)^{2}}$$"
],
"text/plain": [
"diff(rho(t), t) == (y(t)*diff(x(t), t) - x(t)*diff(y(t), t))/y(t)^2"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var('rho x y t')\n",
"x = function('x')(t)\n",
"y = function('y')(t)\n",
"rho = function('rho')(t) == x/y\n",
"drho = diff(rho,t)\n",
"drho.simplify_full()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"cuja solução é $ρ(t)=ρ_0e^{(a−b)t}$. Se $a>b,$ $ρ$ tende a infinito, em cujo caso A vencerá a competição com B, e se $a