Connection
Base URL, credentials and a reachable server.
Review the four slope estimates in DecayMarsh and distinguish the numerical result from the analytic decay value.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
def decay_steps(initial, rate, dt, steps):
if any(type(v) not in (int, float) for v in (initial, rate, dt)):
raise ValueError("decay.numeric")
if not -10**6 <= initial <= 10**6 or not 0 <= rate <= 1000 or not 0 <= dt <= 1 or rate * dt > 1:
raise ValueError("decay.range")
if type(steps) is not int or not 0 <= steps <= 1000:
raise ValueError("decay.steps")
y = float(initial)
for _ in range(steps):
k1 = -rate * y
k2 = -rate * (y + dt*k1/2)
k3 = -rate * (y + dt*k2/2)
k4 = -rate * (y + dt*k3)
y += dt*(k1 + 2*k2 + 2*k3 + k4)/6
return y