Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I NEED HELP WITH PYTHON! PLEASE! Define derivatives function in Step 2. See example code below. Viral infections are one the main causes of disease
I NEED HELP WITH PYTHON! PLEASE! Define derivatives function in Step 2. See example code below.
Viral infections are one the main causes of disease in humans. Along with bacteria and parasite infections, viral infections are caused by the introduction of a microscopic organism" into our bodies. Sometimes these viruses live in our bodies throughout our lifetime with little damage, sometimes, they quickly kill us. We would like to build a model for how viruses infected the cells of our body. We will consider an infection in which our immune system is able to clear the virus. Since winter is coming, consider this to be the influenza virus. How do viruses work? We need to understand a bit about this in order to build our model. The most important feature is that viruses cannot reproduce on their own - that is what they need you for. Your body, to a virus, is simply a factory for making and spreading more of them. If virions were writing the history books, humans would simply be their maternity ward. The way this works is that virions enter your cells, where there is a factory at work to keep the cell functioning, and they give all of the factory workers new instructions. A factory that was making cars, once the virions enter, is now making laptops, or, in this case, rather than keeping the cell alive and healthy, the machinery of the cells makes more virions. For every virion that enters a cellthat cell might make hundreds of new virions, leading to a population explosion. Your body will need to quickly mount an immune response to keep this under control. What compartments might we need? (Look at the picture above.) . Target cells; these are the healthy cells the virion might enter Infected cell; these cells produce new virions, and might die over time Virion population, the number of virions at any given time during the infection What parameters will we need? rate at which cells become infected: this reduces the value of T and increases the value of the production rate of new virions, which increases the value of V . rate at which infected cells die rate at which virions degrade and leave the system Viral Kinetics (VK) Model A simple model is then: =-BTV, di = BTV - 81, di = pl - V. Time to write some code! dr Using this template, fill in your code below for the VK model given above. Here it is again, so that you don't need to keep scrolling up and down: =-BTV, dt = BTV - 81, =pl - rv. Step 1: Setting up the ODES The comparmental model is given to you, and it has already been converted to ODEs in the form odeint wants (see the equations above), you just need to complete the remaining steps. Step 2: Define the derivatives function [ ]: # STEP 2: define the function that contains the derivatives def derivscy, t, beta, delta, p, r): # unpack List of incoming variables # use variables to compute derivatives on the right-hand-side of the above equations # example: dTdt = # return the derivatives in a List by changing the "pass" to "return" along with the correct List pass IMPORTANT IMPORT COMMANDS import matplotlib.pyplot as plt From mpl_toolkits.mplot3d import Axes 3D import numpy as np matplotlib inline Note that the Scipy Library is needed for odeint From scipy.integrate import odeint **# CODE FOR ODE SOLUTION FOR NON-LINEAR OSCILLATOR STEP 2: define your ODE system of equations def deriv_funciy, t, freq): # unpack List coming in that contains current values position = y[@] velocity = y[1] # the right-hand-side of the ODE system of equations deriv_1 = velocity deriv_2 = -freq*82 * np.sin(position) # send back the derivatives return [deriv_1, deriv_2] STEP 3: setup wp the initial conditionsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started