@@ -236,8 +236,9 @@ class ode_solver(object):
236
236
sage: T. function=f_1
237
237
sage: T. jacobian=j_1
238
238
sage: T. ode_solve( y_0=[1,0 ],t_span=[0,100 ],params=[10.0 ],num_points=1000)
239
- sage: outfile = os. path. join( SAGE_TMP, 'sage. png')
240
- sage: T. plot_solution( filename=outfile)
239
+ sage: import tempfile
240
+ sage: with tempfile. NamedTemporaryFile( suffix=". png") as f:
241
+ .... : T. plot_solution( filename=f. name)
241
242
242
243
The solver line is equivalent to::
243
244
@@ -261,9 +262,10 @@ class ode_solver(object):
261
262
262
263
By default T. plot_solution( ) plots the y_0, to plot general y_i use::
263
264
264
- sage: T. plot_solution( i=0, filename=outfile)
265
- sage: T. plot_solution( i=1, filename=outfile)
266
- sage: T. plot_solution( i=2, filename=outfile)
265
+ sage: with tempfile. NamedTemporaryFile( suffix=". png") as f:
266
+ .... : T. plot_solution( i=0, filename=f. name)
267
+ .... : T. plot_solution( i=1, filename=f. name)
268
+ .... : T. plot_solution( i=2, filename=f. name)
267
269
268
270
The method interpolate_solution will return a spline interpolation
269
271
through the points found by the solver. By default y_0 is
@@ -321,13 +323,15 @@ class ode_solver(object):
321
323
following ( WARNING: the following is * not* automatically
322
324
doctested) ::
323
325
324
- sage: T = ode_solver( ) # not tested
325
- sage: T. algorithm = "bsimp" # not tested
326
- sage: vander = van_der_pol( ) # not tested
327
- sage: T. function=vander # not tested
328
- sage: T. ode_solve( y_0 = [1,0 ], t_span=[0,2000 ], num_points=1000) # not tested
329
- sage: T. plot_solution( i=0, filename=os. path. join( SAGE_TMP, 'test. png')) # not tested
330
-
326
+ sage: T = ode_solver( ) # not tested
327
+ sage: T. algorithm = "bsimp" # not tested
328
+ sage: vander = van_der_pol( ) # not tested
329
+ sage: T. function=vander # not tested
330
+ sage: T. ode_solve( y_0 = [1,0 ], t_span=[0,2000 ], # not tested
331
+ .... : num_points=1000) # not tested
332
+ sage: from tempfile import NamedTemporaryFile # not tested
333
+ sage: with NamedTemporaryFile( suffix=". png") as f: # not tested
334
+ .... : T. plot_solution( i=0, filename=f. name) # not tested
331
335
332
336
"""
333
337
def __init__ (self ,function = None ,jacobian = None ,h = 1e-2 ,error_abs = 1e-10 ,error_rel = 1e-10 , a = False ,a_dydt = False ,scale_abs = False ,algorithm = " rkf45" ,y_0 = None ,t_span = None ,params = []):
0 commit comments