Class: Ode::Solver
- Inherits:
-
Object
- Object
- Ode::Solver
- Defined in:
- lib/ode/solver.rb
Instance Attribute Summary collapse
-
#t ⇒ Object
readonly
Returns the value of attribute t.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #f_args(args) ⇒ Object
- #init(t0, y0) ⇒ Object
-
#initialize(f, jac = nil) ⇒ Solver
constructor
A new instance of Solver.
- #integrate(t_out) ⇒ Object
- #method(name) ⇒ Object
Constructor Details
#initialize(f, jac = nil) ⇒ Solver
Returns a new instance of Solver.
3 4 5 6 7 8 9 10 11 |
# File 'lib/ode/solver.rb', line 3 def initialize(f, jac=nil) @f = f @t = 0 @y = 0 @jac = jac @fargs = nil @opts = nil @method = :lsoda end |
Instance Attribute Details
#t ⇒ Object (readonly)
Returns the value of attribute t.
40 41 42 |
# File 'lib/ode/solver.rb', line 40 def t @t end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
40 41 42 |
# File 'lib/ode/solver.rb', line 40 def y @y end |
Instance Method Details
#f_args(args) ⇒ Object
28 29 30 31 |
# File 'lib/ode/solver.rb', line 28 def f_args(args) @fargs=args self end |
#init(t0, y0) ⇒ Object
13 14 15 16 17 |
# File 'lib/ode/solver.rb', line 13 def init(t0, y0) @t = t0 @y = y0 self end |
#integrate(t_out) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/ode/solver.rb', line 33 def integrate(t_out) @opts ||= Ode::Methods.default_opts(@method) @y = Ode::Methods.send(@method, t_out, @f, @jac, @t, @y, @fargs, @opts) @t = t_out self end |