Quiz: Solve Equations with Python

Main.PythonQuiz14 History

Hide minor edits - Show changes to markup

May 18, 2022, at 02:20 AM by 10.35.117.248 -
Added lines 1-98:

(:title Quiz: Solve Equations with Python:) (:keywords quiz, test, Python, plot, linear, nonlinear, solve, equations, introduction, course:) (:description Learning assessment on solving linear and nonlinear equations with Python.:)


1. What is the solution to the following linear system of equations?

$$A x = b$$

where A is a matrix and b is a vector (both known) with vector x unknown.

A. `A=bx^T`
(:toggle hide q1a button show="Select":)

(:div id=q1a:)

Incorrect.

(:divend:)

B. `x=A^{-1}b`
(:toggle hide q1b button show="Select":)

(:div id=q1b:)

Correct.

(:divend:)

C. `x=A^Tb`
(:toggle hide q1c button show="Select":)

(:div id=q1c:)

Incorrect.

(:divend:)

D. `x=b`
(:toggle hide q1d button show="Select":)

(:div id=q1d:)

Incorrect.

(:divend:)


2. What is a possible function to solve `x=A^{-1}b` in Python?

A. numpy.array()
(:toggle hide q2a button show="Select":)

(:div id=q2a:)

Incorrect. The array function builds a Numpy array.

(:divend:)

B. numpy.solve()
(:toggle hide q2b button show="Select":)

(:div id=q2b:)

Incorrect. The solve function is in the linear algebra linalg package that is contained in numpy.

(:divend:)

C. numpy.linalg.solve()
(:toggle hide q2c button show="Select":)

(:div id=q2c:)

Correct. Another potential strategy to solve the linear equations is with numpy.dot(numpy.linalg.inv(A),b).

(:divend:)

D. None of the above
(:toggle hide q2d button show="Select":)

(:div id=q2d:)

Incorrect.

(:divend:)


3. It is important to distinguish between linear and nonlinear equations to know which solution strategy to use. Select the equation that is nonlinear.

A. `10^2x+(15y+3)=10`
(:toggle hide q3a button show="Select":)

(:div id=q3a:)

Incorrect.

(:divend:)

B. `2x+3y=\sqrt{5}`
(:toggle hide q3b button show="Select":)

(:div id=q3b:)

Incorrect.

(:divend:)

C. `5x^2+3y+2=0`
(:toggle hide q3c button show="Select":)

(:div id=q3c:)

Correct.

(:divend:)