def test_03(self): # solve y'=3y y(0) =1 print("****Unit Test 03********") eq = solve_pdeq_with_init_cond(make_const(1.0), make_const(3.0)) assert not eq is None print(eq) eqf = tof(eq) assert not eqf is None err = 0.0001 gt = lambda t: math.e ** (3.0*t) for t in range(100): assert abs(gt(t) - eqf(t)) <= err print("Unit Test 03: pass")
def test_assign_05_prob_01_ut_10(self): print('\n***** Assign 05: Problem 01: Unit Test 10 *****') eq = solve_pdeq_with_init_cond(make_const(4.0), make_const(1.0)) assert not eq is None print eq eqf = tof(eq) assert not eqf is None def gt(t): return 4.0 * math.e**t for t in range(100): #print gt(t), eqf(t) assert abs(gt(t) - eqf(t)) <= 0.0001 print('Assign 05: Problem 01: Unit Test 10: pass')
def test_assign_05_prob_01_ut_06(self): print('\n***** Assign 05: Problem 01: Unit Test 06 *****') eq = solve_pdeq_with_init_cond(make_const(1.0), make_const(3.0)) assert not eq is None print(eq) eqf = tof(eq) assert not eqf is None def gt(t): return math.e**(3.0 * t) err = 0.0001 for t in range(100): #print gt(t), eqf(t) assert abs(gt(t) - eqf(t)) <= err print('Assign 05: Problem 01: Unit Test 06: pass')