Python Programming · High School (11–12) · 1 course, 10 worked problems, 20 practice questions
Many problems in science end with an equation to solve. Some equations have a neat formula, but many do not, such as . A computer can close in on the root step by step. Bisection starts from two values that bracket the root and halves the gap each time. Newton's method uses the slope of the curve to jump closer, but it can fail near a flat point. NumPy finds the roots of a polynomial with np.roots() and solves a set of linear equations with np.linalg.solve(). Fitting a line or a curve to data finds the constants in a law.
np.linalg.solve()Choose an answer, then check it. Each one shows a full explanation.
For f(x) = x**2 - 16, with f'(x) = 2x, what does one Newton step from x = 5 give?
What does np.polyval([2, 0, -1], 3) give?
What is the determinant of the matrix [[2, 1], [4, 3]]?
A bracket is 1 wide. At least how many bisection steps make it narrower than 0.01?
Each one has a hint, the key idea and a full worked solution.
What must be true of f at the two ends a and b so that bisection can start?
A bracket has the width 1. About how wide is it after 10 steps of bisection?
Which line is one step of Newton's method for the function f with the derivative df?
What does np.roots([1, 0, 1]) give?
For which matrix does np.linalg.solve(A, b) raise a LinAlgError?
A student fits a line with np.polyfit(x, y, 1) and gets the array [2.0, 1.0]. The student says that the intercept is 2. What is wrong?