Quiz: Symbolic Math in Python

Main.PythonQuiz17 History

Hide minor edits - Show changes to output

May 18, 2022, at 03:38 AM by 10.35.117.248 -
Changed line 45 from:
-->%red%Incorrect.%% The function returns the derivatives at the current time and state values, not the solution.
to:
-->%red%Incorrect.%% Use sp.Symbol('x').
Changed line 52 from:
-->%red%Incorrect.%% The user-defined function returns the derivatives at the requested time and state values.
to:
-->%red%Incorrect.%% Use sp.Symbol('x')
Changed lines 86-87 from:
-->(:toggle hide q3a button show="Select":)
(:div id=q3a:)
to:
-->(:toggle hide q4a button show="Select":)
(:div id=q4a:)
Changed lines 93-94 from:
-->(:toggle hide q3b button show="Select":)
(:div id=q3b:)
to:
-->(:toggle hide q4b button show="Select":)
(:div id=q4b:)
May 18, 2022, at 03:37 AM by 10.35.117.248 -
Added lines 1-98:
(:title Quiz: Symbolic Math in Python:)
(:keywords quiz, test, Python, plot, sympy, symbolic, equations, introduction, course:)
(:description Learning assessment on symbolic math solutions with Python.:)

----

'''1.''' What are some of the SymPy Python package capabilities for symbolic math operations? Check all that apply.

->'''A.''' Analytic (exact) derivatives

-->(:toggle hide q1a button show="Select":)
(:div id=q1a:)
-->%blue%Correct.%%
(:divend:)

->'''B.''' Analytic (exact) definite integrals

-->(:toggle hide q1b button show="Select":)
(:div id=q1b:)
-->%blue%Correct.%%
(:divend:)

->'''C.''' Analytic (exact) indefinite integrals

-->(:toggle hide q1c button show="Select":)
(:div id=q1c:)
-->%blue%Correct.%%
(:divend:)

->'''D.''' Simplification

-->(:toggle hide q1d button show="Select":)
(:div id=q1d:)
-->%blue%Correct.%%
(:divend:)

----

'''2.''' In order to use the symbolic features of SymPy (import sympy as sp), a variable such as ''x'' must first be declared as follows (see [[https://youtu.be/SFI_l96Oss4|help video]]):

->'''A.''' x = sp.Variable('x')

-->(:toggle hide q2a button show="Select":)
(:div id=q2a:)
-->%red%Incorrect.%% The function returns the derivatives at the current time and state values, not the solution.
(:divend:)

->'''B.''' x = sp.Parameter('x')

-->(:toggle hide q2b button show="Select":)
(:div id=q2b:)
-->%red%Incorrect.%% The user-defined function returns the derivatives at the requested time and state values.
(:divend:)

->'''C.''' x = sp.Symbol('x')

-->(:toggle hide q2c button show="Select":)
(:div id=q2c:)
-->%blue%Correct.%%
(:divend:)

----

'''3.''' Analytic solutions are not exact.

->'''A.''' True

-->(:toggle hide q3a button show="Select":)
(:div id=q3a:)
-->%red%Incorrect.%% Numerical solutions are not exact. Analytic solutions are exact.
(:divend:)

->'''B.''' False

-->(:toggle hide q3b button show="Select":)
(:div id=q3b:)
-->%blue%Correct.%% Numerical solutions are not exact. Analytic solutions are exact.
(:divend:)

----

'''4.''' Numerical solutions are typically an approximation of an exact solution.

->'''A.''' True

-->(:toggle hide q3a button show="Select":)
(:div id=q3a:)
-->%blue%Correct.%% One example is to use a finite difference to calculate a derivative such as df(x)/dx = f(x1)-f(x0) / (x1-x0). As the difference between x1 and x0 decreases, the approximation become more exact until the limits of machine precision (number of decimal places that can be stored by a computer) introduces round-off or truncation error.
(:divend:)

->'''B.''' False

-->(:toggle hide q3b button show="Select":)
(:div id=q3b:)
-->%red%Incorrect.%% The exact analytic solution is often not possible, but the numeric error can be approximated and reduced to a specified level.
(:divend:)

----