Opened 14 years ago

Closed 14 years ago

#3935 closed defect (fixed)

[with patch, positive review] ode_solver __init__ method ignores many parameters

Reported by: jwmerrill Owned by: jkantor
Priority: major Milestone: sage-3.1.2
Component: numerical Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

The following example comes from the in-source documentation for ode_solver:

sage: T = ode_solver()
sage: g_1= lambda t,y: [y[1]*y[2],-y[0]*y[2],-0.51*y[0]*y[1]]
sage: T.function=g_1
sage: T.y_0=[0,1,1]
sage: T.scale_abs=[1e-4,1e-4,1e-5]
sage: T.error_rel=1e-4
sage: T.ode_solve(t_span=[0,12],num_points=100)
sage: f = T.interpolate_solution()
sage: f(pi)              # slightly random precision
0.53794725135406318

It should be possible to set these attributes using arguments to the constructor, but this fails:

sage: T = ode_solver(g_1,y_0=[0,1,1],scale_abs=[1e-4,1e-4,1e-5],error_rel=1e-4)
sage: T.ode_solve(t_span=[0,12],num_points=100)
sage: f = T.interpolate_solution()
sage: f(pi)
Traceback (click to the left for traceback)
...
TypeError: object of type 'NoneType' has no len()

Attachments (2)

ode_solver_patch.patch (2.2 KB) - added by jwmerrill 14 years ago.
Adds a doctest and fixes the init method
ode_solver_patch-referee.patch (868 bytes) - added by jason 14 years ago.

Download all attachments as: .zip

Change History (7)

Changed 14 years ago by jwmerrill

Adds a doctest and fixes the init method

comment:1 Changed 14 years ago by jwmerrill

One thing I'm worried about is that the tests for ode.pyx already take a long time (more than two minutes), and this makes them take even longer.

comment:2 Changed 14 years ago by jwmerrill

  • Summary changed from ode_solver __init__ method ignores many parameters to [with patch, needs review] ode_solver __init__ method ignores many parameters

comment:3 Changed 14 years ago by jason

  • Summary changed from [with patch, needs review] ode_solver __init__ method ignores many parameters to [with patch, positive review] ode_solver __init__ method ignores many parameters

This seems to work and doctests pass. However, the given example is not the same as the example before (as the docs claim), since the algorithm used is different. The referee patch adds an algorithm keyword to make it the same. Apply the referee patch after the original patch and then it is positive review.

Changed 14 years ago by jason

comment:4 Changed 14 years ago by jason

jwmerrill, related to the docs of ode_solver, could you review #3966? Thanks.

comment:5 Changed 14 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from new to closed

Merged both patches in Sage 3.1.2.alpha2

Note: See TracTickets for help on using tickets.