def setUp(self): scheduler.initialize()
def fall_duration_helper(): g = Cell('g') one_half = Cell('one half') t_to_2 = Cell('t^2') g_times_t_to_2 = Cell('gt^2') (constant(Interval(9.789, 9.832)))(g) (constant(Interval(0.5, 0.5)))(one_half) quadratic(t, t_to_2) product(g, t_to_2, g_times_t_to_2) product(one_half, g_times_t_to_2, h) return fall_duration_helper if __name__ == '__main__': scheduler.initialize() # We now build a sequence of sample dependency tracking systems of # increasing complexity. We start with a relatively simple system # that only tracks and reports the provenance of its data. # # How do we want our provenance system to work? We can make cells # and define networks as usual, but if we add supported values as inputs, # we get supported values as outputs: barometer_height = Cell('barometer height') barometer_shadow = Cell('barometer shadow') building_height = Cell('building height') building_shadow = Cell('building shadow') similar_triangles(barometer_shadow, barometer_height, building_shadow, building_height)
defined in this module. """ def good_enuf(g, x, done): @compound(neighbors=[g, x]) def to_do(): g_to_2 = Cell('g^2') x_minus_g_to_2 = Cell('x-g^2') ax_minus_g_to_2 = Cell('abs(x-g^2)') multiplier(g, g, g_to_2) subtractor(x, g_to_2, x_minus_g_to_2) absolute_value(x_minus_g_to_2, ax_minus_g_to_2) less_than(ax_minus_g_to_2, eps, done) return to_do if __name__ == '__main__': scheduler.initialize() x = Cell('x') answer = Cell('answer') sqrt_network(x, answer) x.add_content(2) scheduler.run() print(answer.content)