Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

where P(t) represents number of individuals in a population as a function of tim

ID: 3817916 • Letter: W

Question

where P(t) represents number of individuals in a population as a function of time, t is time, and k is proportionality constant. Consider a particular population of vertebrates whose population growth can be modeled as follows:

The proportionality constant k is 0.1; the units for k are 1/year.

Complete the following:

Numerically solve this population growth problem using the forward Euler integration technique. Use a time step size of 2 years. Store your derivative term in an anonymous function and use that anonymous function in your forward Euler solution implementation.

Next, numerically solve this population growth problem using the built-in function ode45. Instead of using a separate programmer-defined function file, however, define your function inside the ode45 function call like such: ode45(@(t,p) your_function, ...) Remember that one of the inputs to ode45 is another function; here, we are merely defining what the function is inside of the ode45 function call instead of listing the name of another function created elsewhere. The programming paradigm of using functions as inputs to other functions is aptly known in computer science as "functional programming."

Finally, plot the analytic (i.e. exact) result, the forward Euler solution, and the ode45 solution on the same plot. Include an appropriate title, an appropriate xx-label, and an appropriate yy-label. Use different line colors and data markers for each line. Include a legend, and programmatically set the legend so it will automatically be out of the way of the data.

A sample solution plot follows:

dPlt). == kP(t) dt

Explanation / Answer

class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120))
password_hash = db.Column(db.String(64))
username = db.Column(db.String(64), unique=True, index=True)
@password.setter
def password(self, secret key):
self.password_hash = generate_password_hash(password)
def __repr__(self):
return '<User %r>' % self.username
#Create custom models see
class MyModelView(sqla.ModelView):
@admin.expose('/login/')
def index(self):
return self.render('login.html')
# Create custom administrator see
class MyAdminView(admin.BaseView):
@admin.expose('/')
def index(self):
return self.render('myadmin.html')
administrator = admin.Admin(name="Simple Views")
admin.add_view(MyAdminView(name='hello'))
admin.add_view(MyModelView(User, db.session))
admin.init_app(app)
app.run()
cup administrator