Skip to content

Commit

Permalink
Update acrobot docstrings (#2362)
Browse files Browse the repository at this point in the history
Removed time from the signature of derivs in the documentation. Also fixed a typo and removed an example that's no longer valid
  • Loading branch information
RedTachyon authored Aug 26, 2021
1 parent 5af9104 commit bbb3072
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions gym/envs/classic_control/acrobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,31 +273,26 @@ def rk4(derivs, y0, t):
:func:`scipy.integrate`.
Args:
derivs: the derivative of the system and has the signature ``dy = derivs(yi, ti)``
derivs: the derivative of the system and has the signature ``dy = derivs(yi)``
y0: initial state vector
t: sample times
args: additional arguments passed to the derivative function
kwargs: additional keyword arguments passed to the derivative function
Example 1 ::
## 2D system
def derivs6(x,t):
def derivs(x):
d1 = x[0] + 2*x[1]
d2 = -3*x[0] + 4*x[1]
return (d1, d2)
dt = 0.0005
t = arange(0.0, 2.0, dt)
y0 = (1,2)
yout = rk4(derivs6, y0, t)
Example 2::
## 1D system
alpha = 2
def derivs(x,t):
return -alpha*x + exp(-t)
y0 = 1
yout = rk4(derivs, y0, t)
If you have access to scipy, you should probably be using the
scipy.integrate tools rather than this function.
scipy.integrate tools rather than this function.
This would then require re-adding the time variable to the signature of derivs.
Returns:
yout: Runge-Kutta approximation of the ODE
Expand Down

0 comments on commit bbb3072

Please sign in to comment.