AME 209: 19. Numerical Methods in Python (NumPy and SciPy)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/28

flashcard set

Earn XP

Description and Tags

By the end of this section, students should be able to... • Load the correct modules to apply various numerical methods • Use root_scalar to find roots numerically • Perform 1D interpolation interp1d with different methods (e.g., linear, cubic) • Solve systems of linear equations using linalg.solve • Integrate numerically using the Riemann sums and built-in methods such as trapz and integrate.quad • Compute numerical derivatives using forward, backward, centered finite difference schemes, and the gradient function • Convert a higher order ODE to a system of first order ODEs (reduction of order) • Solve ODEs using the solve_ivp function • Convert an BVP to an IVP and combine root finding and ODE solvers

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

29 Terms

1
New cards

Numerical Methods

echniques used to approximate solutions to mathematical problems that can’t be solved analytically.

2
New cards

root_scalar()

Function from scipy.optimize used to numerically find the root of a function f(x)=0f(x) = 0f(x)=0.

3
New cards

Bracket (in root_scalar)

A tuple [a, b] specifying the interval in which to search for a root (used with methods like 'bisect' or 'brentq').

4
New cards

Method (in root_scalar)

Algorithm used for root finding: 'bisect', 'newton', 'brentq', 'secant', etc.

5
New cards

Bisection Method

A bracketing method that repeatedly halves the interval where a sign change occurs. Always converges but slower.

6
New cards

Newton-Raphson Method

A faster root-finding method that uses the derivative of the function, but requires a good initial guess and can fail to converge.

7
New cards

Brent’s Method

A hybrid root-finding method combining bisection, secant, and inverse quadratic interpolation—robust and fast.I

8
New cards

Interpolation

Estimating values between known data points.

9
New cards

interp1d()

Function from scipy.interpolate that creates an interpolation function from discrete data (supports 'linear', 'cubic', etc.).

10
New cards

Linear Interpolation

Connects data points with straight lines. Simple but may not be smooth.

11
New cards

Cubic Interpolation

Uses cubic polynomials between data points. Produces a smoother curve.

12
New cards

linalg.solve()

Function from numpy.linalg to solve systems of linear equations Ax=bAx = bAx=b.

13
New cards

Numerical Integration

Approximation of definite integrals using summation methods.

14
New cards

Riemann Sum

A basic numerical integration method using rectangles.

15
New cards

np.trapz()

NumPy function that performs trapezoidal rule integration for discrete data.

16
New cards

integrate.quad()

High-accuracy integration of continuous functions using adaptive quadrature (from scipy.integrate).

17
New cards

Finite Difference

Method for approximating derivatives using nearby function values.

18
New cards

Forward Difference

<p> </p>
19
New cards

Backward Difference

knowt flashcard image
20
New cards

Centered Difference

knowt flashcard image
21
New cards

np.gradient

Function that computes numerical derivatives using centered differences by default.

22
New cards

ODE (Ordinary Differential Equation)

An equation involving derivatives of a function with respect to one variable.

23
New cards

Reduction of Order

Process of converting a higher-order ODE into a system of first-order ODEs for numerical solving.

24
New cards

solve_inp()

Function from scipy.integrate to numerically solve initial value problems for ODEs.

25
New cards

Initial Value Problem (IVP)

An ODE with specified value(s) at the start of the interval.

26
New cards

Boundary Value Problem (BVP)

An ODE with specified values at both ends of the interval. Often converted to IVP for numerical solving.

27
New cards

sol.root

Attribute of root_scalar() result: the computed root.

28
New cards

sol.converged

Attribute: Boolean indicating whether the method successfully found a root.

29
New cards

sol.flag

Attribute: String that summarizes the solver’s result (e.g., 'converged', 'convergence failure').