Ask Your Question

kaylavb23's profile - activity

2019-02-11 13:45:49 -0600 received badge  Popular Question (source)
2017-10-19 09:37:54 -0600 asked a question Graphing ineqalities

So I'm trying to graph the inequality x+y+3u>=0 I want to keep the u fixed, but I'm having issues finding out how to do that.

Also, I was wondering if it would be possible to have some type of dynamic slider for u, so that this way I can change the value of u.

2017-09-17 17:05:33 -0600 asked a question Rewrite equilibrium variables in terms of another variable

I'm wondering how to replace the equilibrium variables in terms of another one. I want the equilibrium to be in terms of a new varible called R = beta*o/(u+y)(u+o) and I can't seem to find the right function that would allow me to do this.

Equilibrium point: S= (u+y)(u+o)/beta*o Want: S = 1/R

2017-02-16 15:17:29 -0600 asked a question ValueError: error solving

I don't understand stand why sagemath says that there is a error solving when it solves the differential equations just fine without the beta_h * S *H in the equations. Any ideas?

Population size

N = 10

Initial infections

IInit = 1 HInit = 1 EInit = 1 SInit = 7 RInit = 0

beta = .1 alpha = .1 gamma_h = .3 gamma_ih = .1 gamma_1 =.2 theta = .2 delta = .1 delta_2 = .2 delta_1 = .1 gamma = .1

End time

tMax = 10

Standard SIR model

def ODE_RHS(t, Y): (S, I, E, H, R) = Y

dS = - (beta * S * I + beta_h * S * H)/ N
dE = (beta * S * I + beta_h * S * H)/ N - (alpha * E)
dI = (alpha * E) - (gamma_h * (theta) + gamma_1*(1-theta)*(1-delta_1)) * I
dH = (gamma_h * theta) * I - (gamma_ih * (1-delta_2) * H)
dR = (gamma_ih * (1-delta_2) * H) +  gamma_1*(1-theta)*(1-delta_1)*I

return (dS, dI, dE, dH, dR)

Set up numerical solution of ODE

solver = ode_solver(function = ODE_RHS, y_0 = (SInit, IInit, EInit, HInit, RInit), t_span = (0, tMax), algorithm = 'rk8pd')

Numerically solve

solver.ode_solve(num_points = 1)

Plot solution

show( plot(solver.interpolate_solution(i = 0), 0, tMax, legend_label = 'S(t)', color = 'green') + plot(solver.interpolate_solution(i = 2), 0, tMax, legend_label = 'I(t)', color = 'red') + plot(solver.interpolate_solution(i = 4), 0, tMax, legend_label = 'R(t)', color = 'blue') + plot(solver.interpolate_solution(i = 1), 0, tMax, legend_label = 'E(t)', color = 'pink') + plot(solver.interpolate_solution(i = 3), 0, tMax, legend_label = 'H(t)', color = 'black') )

2017-01-14 20:44:20 -0600 asked a question plot point color change

How do change the plot point color so that I can tell the difference between my three different equations? Here is what I have so far:

S = []
I = []
R = []

S.append(100000)
I.append(100)
R.append(0)

beta = 100
gamma = .4
lamda = 5e-006
mu = .001

i = 0
while(i<100):
    R.append(R[i] + (-mu * R[i] + gamma * I[i]))
    I.append(I[i] + (-mu * I[i] + lamda * S[i] * I[i] - gamma * I[i]))
    S.append(S[i] + (beta - mu * S[i] - lamda * S[i] * I[i]))

    i = i+1


N=range(1,100)

A = S
AN=zip(N,A)

B = I
BN=zip(N,B)

C = R
RN = zip(N,R)

plot(point(BN), legend_label = 'S(t)', color = 'green')
2016-12-09 20:54:33 -0600 received badge  Editor (source)
2016-12-09 20:35:40 -0600 asked a question SIR desolve_system

var('beta gamma S I R N') dS = - beta * S * I /N dI = beta * S * I / N - gamma * I dR = gamma * I

equilibria = solve([dS, dI, dR], [S, I, R]) show(equilibria) solve([dS == 0, dI == 0, dR == 0], [S, I])

and the output is [[S == r76, I == 0, R == r77]] but I know that there is a second one with S == 0, I == 0 and R == 0. I have tried using desolve_system in the hopes that it prints out both answers but it asks for the ivar and I need it to solve both S and I. Is there some other way or command that I can use where sage will give me both [S == r1, I == 0, R == r1] and [ S == I == R == 0]?

2016-11-20 06:11:18 -0600 received badge  Student (source)
2016-11-20 05:44:17 -0600 asked a question Epidemiology equilibria solved, but what happened??

var('beta gamma S I R N')

dS = - beta * S * I / N dI = beta * S * I / N - gamma * I dR = gamma * I

solve([dS == 0, dI == 0, dR == 0], [S, I, R]) [[S == r7, I == 0, R == r8]]

Why am i getting different values for S and R which correlate to how many times I run the code? At first I thought that it was because I did an interpolate above, but when I went and modified the code a bit at the beginning I was still left with increasing equilibria values.

the next run will be [[S == r9, I == 0, R == r10]] Does anyone know why this is happening??