Quiz: Solve ODEs with Python

Main.PythonQuiz16 History

Hide minor edits - Show changes to output

May 18, 2022, at 03:20 AM by 10.35.117.248 -
Added lines 1-80:
(:title Quiz: Solve ODEs with Python:)
(:keywords quiz, test, Python, plot, differential, equation, introduction, course:)
(:description Learning assessment on solving differential equations with Python.:)

----

'''1.''' The ODEINT function requires a user defined function that includes time (''t'') and the current system states (''y''). What is the correct definition of the function named ''myFunction''?

->'''A.''' def myFunction(t,y):

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

->'''B.''' y,t = myFunction()

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

->'''C.''' def myFunction(y,t):

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

->'''D.''' def myFunction([t,y]):

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

----

'''2.''' The current time (''t'') and system states (''y'') are required as arguments to a custom function for ODEINT in Python. What is returned from the custom function? See [[https://apmonitor.com/pdc/index.php/Main/SolveDifferentialEquations|ODEINT tutorials]] for additional help.

->'''A.''' The solution at the next time point: y[k+1]

-->(: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.''' A list or array of the differential equation derivatives: dy/dt

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

->'''C.''' The time and the solution state values: t, y

-->(:toggle hide q2c button show="Select":)
(:div id=q2c:)
-->%red%Incorrect.%% Those are the inputs to the function.
(:divend:)

----

'''3.''' ODEINT can simultaneously solve coupled differential equations?

->'''A.''' True

-->(:toggle hide q3a button show="Select":)
(:div id=q3a:)
-->%blue%Correct.%% ODEINT can solve many coupled differential equations, but solution time increases more with >1000 equations.
(:divend:)

->'''B.''' False

-->(:toggle hide q3b button show="Select":)
(:div id=q3b:)
-->%red%Incorrect.%% Numerical solutions are often possible with many coupled differential equations.
(:divend:)

----