AMATH Quiz 6

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/38

flashcard set

Earn XP

Description and Tags

Scalar Differential Equations; Systems of Differential Equations

Last updated 3:43 AM on 2/20/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

39 Terms

1
New cards

What is a differential equation?

An equation that involves derivatives of one or more dependent variables with respect to one or more independent variables.

2
New cards

What is an Initial Value Problem (IVP)?

A differential equation plus the value of the unknown function at some particular time

3
New cards

What is the general form of an IVP?

x(t)=f(t,x(t))x^{\prime}\left(t\right)=f\left(t,x\left(t\right)\right) x(0)=0x\left(0\right)=0

4
New cards

What is the equation for Forward Euler when used on an IVP?

xk+1=xk+Δtf(tk,xk)x_{k+1}=x_{k}+\Delta tf\left(t_{k},x_{k}\right)

5
New cards

Give an example of a Forward Euler Solver.

def forward_euler(ode, IC, t):
    """
    t = np.arange(0, T+dt/2, dt)
    V = np.zeros(t.size)
    Inputs:
        - ode = lambda or python function, of the form ode(t,V)
                t is independent variable, V is dependent variable
        - IC = the initial condition
        - t  = times at which we want the solution. Extract dt from this.
    """
    V = np.zeros(t.size) # Setup solution array 
    V[0] = IC			 # Define the initial condition
    dt = t[1]-t[0]		 # Calculate dt
    
    # Use a for loop for Forward Euler
    for i in range(t.size - 1):
        V[i+1] = V[i] + dt * ode(t[i], V[i])
    
    return V

6
New cards

What is the equation for Backward Euler when used on an IVP?

xk+1=xk+Δtf(tk+1,xk+1)x_{k+1}=x_{k}+\Delta tf\left(t_{k+1},x_{k+1}\right)

7
New cards

What is the format for solve_ivp?

sol = scipy.integrate.solve_ivp(ODE, [start, end], [IC], t_eval = t_span)

8
New cards

What is sol.t ?

The t values at which the approximate solution is found.

9
New cards

What is sol.y[number] ?

The approximate solution at the corresponding t value.

10
New cards

Are “solutions” found numerically approximations to a discretization of the true solution of an IVP?

Yes.

11
New cards

Is the Forward Euler Method explicit or implicit?

explicit

12
New cards

Is the Backward Euler Method explicit or implicit?

implicit

13
New cards

Which is better for solving stiff IVPS? Explicit or implicit methods?

Implicit methods.

14
New cards

What is the order of accuracy of the forward and backward Euler methods?

first-order accurate

15
New cards

What is the FIRST step for using solve_ivp to solve systems of IVPs?

Define both ODEs

16
New cards

What is the SECOND step for using solve_ivp to solve systems of IVPs?

Put the ODEs into an ODE System

17
New cards

What is the THIRD step for using solve_ivp to solve systems of IVPs?

Package them in terms of one dependent-variable input

18
New cards

What is the FINAL step for using solve_ivp to solve systems of IVPs?

Use solve_ivp on the new ODE

19
New cards

Show an example of solve_ivp being used to solve systems of IVPs

dxdt = lambda x, y: 2*x - x*y
dydt = lambda x, y: -0.5*y + 0.2*x*y

ode_system = lambda x, y: np.array([dxdt(x,y), dydt(x,y)])

ode = lambda t, z: ode_system(z[0], z[1])


t_span = np.linspace(0, 15, 1000)
sol = solve_ivp(ode, [0, 15], np.array([6, 2]), t_eval = t_span)

20
New cards

How do you plot IVP solutions from systems of ODEs?

ax.plot(t, x)

21
New cards

When does convergence happen?

As x approaches 0.

22
New cards

What is the FIRST step to create phase portraits for 2D systems of IVPs?

Extract time values and z

23
New cards

What is the SECOND step to create phase portraits for 2D systems of IVPs?

Extract x and y from z.

24
New cards

What is the FINAL step to create phase portraits for 2D systems of IVPs?

ax.plot(x, y)

25
New cards

Give an example of a phase portrait for 2D systems of IVPs being created.

dxdt = lambda x, y: 2*x - x*y
dydt = lambda x, y: -0.5*y + 0.2*x*y

ode_system = lambda x, y: np.array([dxdt(x,y), dydt(x,y)])

ode = lambda t, z: ode_system(z[0], z[1])


t_span = np.linspace(0, 15, 1000)
sol = solve_ivp(ode, [0, 15], np.array([6, 2]), t_eval = t_span)


t = sol.t
z = sol.y

x = z[0]
y = z[1]


fig, ax = plt.subplots()

ax.plot(x, y)

26
New cards

Give an example of lambda being used.

f = lambda x: x**2 + 4

27
New cards

What is the standard format for def ?

def function_name(parameters):
    # Function body
    return value  # Optional

28
New cards

What is the standard format for range?

range(start, stop, step)

29
New cards

Give an example of a Numpy array.

A = np.array([1, 2, 3])

30
New cards

Give an example of a Numpy array filled with zeros.

Z = np.zeros(5)

31
New cards

What is the standard format for Numpy linspace?

np.linspace(start, stop, step)

32
New cards

What does “step” in range and np.arange mean?

The size of increments between numbers.

33
New cards

What does “step” in np.linspace mean?

The number of steps in the array.

34
New cards

What is the standard format for Numpy arange?

np.arange(start, stop, step)

35
New cards

What does np.log() mean?

Natural logarithm

36
New cards

What does np.exp() mean?

e to the x power.

37
New cards

What does scipy.optimize.fsolve do?

It finds the root(s) of a function.

38
New cards

What is the format for scipy.optimize.fsolve ?

root = scipy.optimize.fsolve(function, array)

39
New cards

What are some Matplotlib plot functions?

import matplotlib as plt

fig, ax = plt.subplots()
ax.plot()
plt.show() # or plt.savefig('Name.png')