moorepants / me41055

Course website for TU Delft's Multibody Dynamics B course
https://moorepants.github.io/me41055
Creative Commons Attribution 4.0 International
1 stars 3 forks source link

Create the 12 homeworks #2

Closed moorepants closed 2 years ago

moorepants commented 2 years ago

Homework design

Homework inspiration sources

Tips

To check whether symbolic equations are correct, it's best to evaluate them with some specific or random numerical inputs. The basic form of the asserions should look like:

expr = a + b*sm.cos(theta)  # student's answer

# assertions
eval_students_expr = sm.lambdify((a, b, theta), expr)
np.testing.assert_allclose(12.0 - 0.45*np.cos(23994.0),
                           eval_students_expr(12.0, -0.45, 23994.0))

This will check floating point evaluations of the symbolic expressions. Do it for several unique sets of numerical inputs to check the a realistic range of values. This will avoid the long duration required to simplify symbolics and avoid the problem that comparing two symbolic expressions directly will generally fail.

Symbolic calculations can often take a long time to compute especially for naive choices in how the code is written. We'll probably need a way to have nbgrader time out on the autograding and give up. We should warn students that correct solutions should take only a second or so to run (and design our problems so that is true).

Homework suggestions

moorepants commented 2 years ago

I've moved this information to the new private homework repository. See https://github.com/moorepants/me41055-homework/issues/1