Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ee4db9

Browse files
committed
Remove mlab.rk4
1 parent 4ec8a60 commit 8ee4db9

File tree

3 files changed

+2
-72
lines changed

3 files changed

+2
-72
lines changed

doc/api/next_api_changes/2018-09-18-DS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ in Matplotlib 2.2 has been removed. See below for a list:
1515
- `mlab.prctile` (use numpy.percentile instead)
1616
- `mlab.prctile_rank`
1717
- `mlab.center_matrix`
18+
- `mlab.rk4` (use scipy.integrate.ode instead)
1819
- `mlab.donothing_callback`

lib/matplotlib/mlab.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,77 +1194,6 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
11941194
return Cxy, f
11951195

11961196

1197-
@cbook.deprecated('2.2', 'scipy.integrate.ode')
1198-
def rk4(derivs, y0, t):
1199-
"""
1200-
Integrate 1D or ND system of ODEs using 4-th order Runge-Kutta.
1201-
This is a toy implementation which may be useful if you find
1202-
yourself stranded on a system w/o scipy. Otherwise use
1203-
:func:`scipy.integrate`.
1204-
1205-
Parameters
1206-
----------
1207-
y0
1208-
initial state vector
1209-
1210-
t
1211-
sample times
1212-
1213-
derivs
1214-
returns the derivative of the system and has the
1215-
signature ``dy = derivs(yi, ti)``
1216-
1217-
Examples
1218-
--------
1219-
1220-
A 2D system::
1221-
1222-
def derivs6(x,t):
1223-
d1 = x[0] + 2*x[1]
1224-
d2 = -3*x[0] + 4*x[1]
1225-
return (d1, d2)
1226-
dt = 0.0005
1227-
t = arange(0.0, 2.0, dt)
1228-
y0 = (1,2)
1229-
yout = rk4(derivs6, y0, t)
1230-
1231-
A 1D system::
1232-
1233-
alpha = 2
1234-
def derivs(x,t):
1235-
return -alpha*x + exp(-t)
1236-
1237-
y0 = 1
1238-
yout = rk4(derivs, y0, t)
1239-
1240-
If you have access to scipy, you should probably be using the
1241-
scipy.integrate tools rather than this function.
1242-
"""
1243-
1244-
try:
1245-
Ny = len(y0)
1246-
except TypeError:
1247-
yout = np.zeros((len(t),), float)
1248-
else:
1249-
yout = np.zeros((len(t), Ny), float)
1250-
1251-
yout[0] = y0
1252-
1253-
for i in np.arange(len(t)-1):
1254-
1255-
thist = t[i]
1256-
dt = t[i+1] - thist
1257-
dt2 = dt/2.0
1258-
y0 = yout[i]
1259-
1260-
k1 = np.asarray(derivs(y0, thist))
1261-
k2 = np.asarray(derivs(y0 + dt2*k1, thist+dt2))
1262-
k3 = np.asarray(derivs(y0 + dt2*k2, thist+dt2))
1263-
k4 = np.asarray(derivs(y0 + dt*k3, thist+dt))
1264-
yout[i+1] = y0 + dt/6.0*(k1 + 2*k2 + 2*k3 + k4)
1265-
return yout
1266-
1267-
12681197
@cbook.deprecated('2.2')
12691198
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0,
12701199
mux=0.0, muy=0.0, sigmaxy=0.0):

lib/matplotlib/pylab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
identity, inside_poly, is_closed_polygon, ispower2, isvector, l1norm,
238238
l2norm, log2, movavg, norm_flat,
239239
path_length, poly_below, poly_between,
240-
rec2csv, rec_append_fields, rec_drop_fields, rec_join, rk4, rms_flat,
240+
rec2csv, rec_append_fields, rec_drop_fields, rec_join, rms_flat,
241241
segments_intersect, slopes, stineman_interp, vector_lengths,
242242
window_hanning, window_none)
243243

0 commit comments

Comments
 (0)