Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1h) - Testing the solve function 1p Write two tests where you test that both the time array and the solution to the

Exercise 1h) - Testing the solve function 1p Write two tests where you test that both the time array and the

Exercise 1h) - Testing the solve function 1p Write two tests where you test that both the time array and the solution to the ODE is correct test_solve_time: Should make sure that: The first time point is zero. The last time point is T. The difference between the second and first time point is dt. test_solve_solution: Should make sure that the relative error of the difference between the exact and computed is within 1%. Both tests should be parametrized using pytest.mark.parametrize with respect to a, up, T and dt and test at least three different inputs. Hint - Comparing with the exact solution The exact solution of the exponential decay ODE is given by u(t)= use Hint - Computing the relative error If you have the compute solution y and the exact solution y_exact then you can compute the relative error as import numpy as np relative_error = np. linalg.norm(y- y_exact) /np.linalg.nor

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The exercise is about creating tests to verify the correctness of a solution to an ordinary differential equation ODE obtained through a solve functio... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing Cases An Interactive Learning Approach

Authors: Mark S Beasley, Frank A. Buckless, Steven M. Glover, Douglas F Prawitt

7th Edition

0134421825, 9780134421827

More Books

Students also viewed these Programming questions