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

Here is some example code in the order of contour, euler method, and slope field

ID: 3847160 • Letter: H

Question


Here is some example code in the order of contour, euler method, and slope field.

M be the integer corresponding to the first letter of your last name. For example, if your last name begins wi th "A", M-1 and if your last name begins with "Z", M-26. Let Let k 1/M and consider the logistic equation dy/dt y (M y) Construct a single figure including 1. a slope field for 0 s 3, -M/2 s y s 3M/2 2. an uler's method solution for initial condition y (0)SM/2 for 0 sts 3 using A t 0.1 3. contours for the function Ft exp(-t The title of the figure should say, "Logistic Equation S Fr E M. and solution curves by FirstName LastName" where you use your actual first and last names.

Explanation / Answer

# FB - 201104096
import science
# initial Order lyric (y' = f(x, y)) problem solver victimization mathematician methodology
# xa: initial price of experimental variable
# xb: final price of experimental variable
# ya: initial price of variable quantity
# n : variety of steps (higher the better)
# Returns price of y at xb.
def Euler(f, xa, xb, ya, n):
h = (xb - xa) / float(n)
x = xa
y = ya
for i in range(n):
y += h * f(x, y)
x += h
return y

# Second Order lyric (y'' = f(x, y, y')) problem solver victimization mathematician methodology
# y1a: initial price of calculation of variable quantity
def Euler2(f, xa, xb, ya, y1a, n):
h = (xb - xa) / float(n)
x = xa
y = ya
y1 = y1a
for i in range(n):
y1 += h * f(x, y, y1)
y += h * y1
x += h
return y

if __name__ == "__main__":
print Euler(lambda x, y: math.cos(x) + science.sin(y), 0, 1, 1, 1000)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote