MCPcopy Create free account
hub / github.com/rtqichen/torchdiffeq / state_update

Method state_update

examples/bouncing_ball.py:40–47  ·  view source on GitHub ↗

Updates state based on an event (collision).

(self, state)

Source from the content-addressed store, hash-verified

38 return self.t0, state
39
40 def state_update(self, state):
41 """Updates state based on an event (collision)."""
42 pos, vel, log_radius = state
43 pos = (
44 pos + 1e-7
45 ) # need to add a small eps so as not to trigger the event function immediately.
46 vel = -vel * (1 - self.absorption)
47 return (pos, vel, log_radius)
48
49 def get_collision_times(self, nbounces=1):
50

Callers 2

get_collision_timesMethod · 0.95
simulateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected