docutils.nodesdocument)}( rawsourcechildren](htarget)}(h
.. _scipy:h]
attributes}(ids]classes]names]dupnames]scipyabackrefs]refidscipyutagnameh lineKparenthhhsource>/builds/software/pyanalog-mirror-from-github/doc/dda-scipy.rst
referencedKubhsection)}(hhh](htitle)}(h,DDA SciPy interface (to generic ODE solvers)h]hText,DDA SciPy interface (to generic ODE solvers)}(hh-h h+hhh!NhNubah}(h]h]h]h]h]uhh)h h&hhh!h"hKubsphinx.addnodesindex)}(hhh]h}(h]h]h]h]h]entries](pairmodule; dda.scipymodule-dda.scipyhNtauhh`_.
For the usage and examples, see the main class :class:`to_scipy`.h](h0The }(hThe h hPhhh!NhNubhliteral)}(h
``dda.scipy``h]h0 dda.scipy}(hhh h[ubah}(h]h]h]h]h]uhhYh hPubh0u module allows in-python evaluation of DDA systems
as well as their solution with ODE Integrators in Python,
such as }(hu module allows in-python evaluation of DDA systems
as well as their solution with ODE Integrators in Python,
such as h hPhhh!NhNubh reference)}(hW`scipy.integrate `_h]h0scipy.integrate}(hscipy.integrateh hpubah}(h]h]h]h]h]namehxrefuriBhttps://docs.scipy.org/doc/scipy/reference/tutorial/integrate.htmluhhnh hPubh
)}(hE h]h}(h]scipy-integrateah]h]scipy.integrateah]h]refurihuhh h#Kh hPubh01.
For the usage and examples, see the main class }(h1.
For the usage and examples, see the main class h hPhhh!NhNubh;pending_xref)}(h:class:`to_scipy`h]hZ)}(hhh]h0to_scipy}(hhh hubah}(h]h](xrefpypy-classeh]h]h]uhhYh hubah}(h]h]h]h]h]refdoc dda-scipy refdomainhreftypeclassrefexplicitrefwarn py:module dda.scipypy:classN reftargetto_scipyuhhh!P/builds/software/pyanalog-mirror-from-github/dda/scipy.py:docstring of dda.scipyhKh hPubh0.}(h.h hPhhh!NhNubeh}(h]h]h]h]h]uhhNh!hhKh h&hhubhnote)}(hyIn order to run this code, you need, obviously, `SciPy `_ next
to `NumPy `_.h]hO)}(hyIn order to run this code, you need, obviously, `SciPy `_ next
to `NumPy `_.h](h00In order to run this code, you need, obviously, }(h0In order to run this code, you need, obviously, h hubho)}(h!`SciPy `_h]h0SciPy}(hSciPyh hubah}(h]h]h]h]h]namehhhttps://www.scipy.org/uhhnh hubh
)}(h h]h}(h]id1ah]h]h]hah]refurihuhh h#Kh hubh0
next
to }(h
next
to h hubho)}(h`NumPy `_h]h0NumPy}(hNumPyh hubah}(h]h]h]h]h]namejhhttps://numpy.org/uhhnh hubh
)}(h h]h}(h]numpyah]h]numpyah]h]refurij uhh h#Kh hubh0.}(hhh hubeh}(h]h]h]h]h]uhhNh!hhKh hubah}(h]h]h]h]h]uhhh h&hhh!hhNubhwarning)}(hXIThis module exposes a solver of a DDA system which is quite different to the
:mod:`cpp_exporter`. In particular,
* The solver is required to be told the solution time span or final time in
time units, not iteration indices.
* The solver only spills out the evolved (integration) quantities and not any
derived quantities. You can recompute them at any timestep, but there is currently
no code helping you in order to archieve this result. This can result in confusion
when you cannot query the fields you asked for (in particular in the CLI frontend).
* The SciPy time integrator tries to find an optimal (and minimal) time step, yielding
in a quite "rough" solution. You can turn on *dense output* in order to tell the
SciPy solver to integrate between these time steps, yielding a more smooth output
with more datapoints. h](hO)}(hpThis module exposes a solver of a DDA system which is quite different to the
:mod:`cpp_exporter`. In particular,h](h0MThis module exposes a solver of a DDA system which is quite different to the
}(hMThis module exposes a solver of a DDA system which is quite different to the
h j-ubh)}(h:mod:`cpp_exporter`h]hZ)}(hj8h]h0cpp_exporter}(hhh j:ubah}(h]h](hpypy-modeh]h]h]uhhYh j6ubah}(h]h]h]h]h]refdoch refdomainjDreftypemodrefexplicitrefwarnhhhNhcpp_exporteruhhh!hhK
h j-ubh0. In particular,}(h. In particular,h j-ubeh}(h]h]h]h]h]uhhNh!hhK
h j)ubhbullet_list)}(hhh](h list_item)}(hlThe solver is required to be told the solution time span or final time in
time units, not iteration indices.h]hO)}(hlThe solver is required to be told the solution time span or final time in
time units, not iteration indices.h]h0lThe solver is required to be told the solution time span or final time in
time units, not iteration indices.}(hjnh jlubah}(h]h]h]h]h]uhhNh!hhKh jhubah}(h]h]h]h]h]uhjfh jcubjg)}(hXEThe solver only spills out the evolved (integration) quantities and not any
derived quantities. You can recompute them at any timestep, but there is currently
no code helping you in order to archieve this result. This can result in confusion
when you cannot query the fields you asked for (in particular in the CLI frontend).h]hO)}(hXEThe solver only spills out the evolved (integration) quantities and not any
derived quantities. You can recompute them at any timestep, but there is currently
no code helping you in order to archieve this result. This can result in confusion
when you cannot query the fields you asked for (in particular in the CLI frontend).h]h0XEThe solver only spills out the evolved (integration) quantities and not any
derived quantities. You can recompute them at any timestep, but there is currently
no code helping you in order to archieve this result. This can result in confusion
when you cannot query the fields you asked for (in particular in the CLI frontend).}(hjh jubah}(h]h]h]h]h]uhhNh!hhKh jubah}(h]h]h]h]h]uhjfh jcubjg)}(hXThe SciPy time integrator tries to find an optimal (and minimal) time step, yielding
in a quite "rough" solution. You can turn on *dense output* in order to tell the
SciPy solver to integrate between these time steps, yielding a more smooth output
with more datapoints. h]hO)}(hX
The SciPy time integrator tries to find an optimal (and minimal) time step, yielding
in a quite "rough" solution. You can turn on *dense output* in order to tell the
SciPy solver to integrate between these time steps, yielding a more smooth output
with more datapoints.h](h0The SciPy time integrator tries to find an optimal (and minimal) time step, yielding
in a quite “rough” solution. You can turn on }(hThe SciPy time integrator tries to find an optimal (and minimal) time step, yielding
in a quite "rough" solution. You can turn on h jubhemphasis)}(h*dense output*h]h0dense output}(hhh jubah}(h]h]h]h]h]uhjh jubh0} in order to tell the
SciPy solver to integrate between these time steps, yielding a more smooth output
with more datapoints.}(h} in order to tell the
SciPy solver to integrate between these time steps, yielding a more smooth output
with more datapoints.h jubeh}(h]h]h]h]h]uhhNh!hhKh jubah}(h]h]h]h]h]uhjfh jcubeh}(h]h]h]h]h]bullet*uhjah!hhKh j)ubeh}(h]h]h]h]h]uhj'h h&hhh!NhNubh=)}(hhh]h}(h]h]h]h]h]entries](single'evaluate_values() (in module dda.scipy)dda.scipy.evaluate_valueshNtauhh`_.
There is no other scipy dependence in this code.h](h0You can evaluate these quantities in any python context, i.e. with any scientific python
ODE solver library. For the time being, this class provides a convenience method
}(hYou can evaluate these quantities in any python context, i.e. with any scientific python
ODE solver library. For the time being, this class provides a convenience method
h jhhh!NhNubh)}(h
:meth:`solve`h]hZ)}(hjh]h0solve()}(hhh jubah}(h]h](hpypy-metheh]h]h]uhhYh jubah}(h]h]h]h]h]refdoch refdomainjreftypemethrefexplicitrefwarnhjBhjhsolveuhhh!jhKh jubh0
which calls }(h
which calls h jhhh!NhNubho)}(hr`scipy.integrate.solve_ivp `_h]h0scipy.integrate.solve_ivp}(hscipy.integrate.solve_ivph jubah}(h]h]h]h]h]namej"hShttps://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.htmluhhnh jubh
)}(hV h]h}(h]scipy-integrate-solve-ivpah]h]scipy.integrate.solve_ivpah]h]refurij*uhh h#Kh jubh02.
There is no other scipy dependence in this code.}(h2.
There is no other scipy dependence in this code.h jhhh!NhNubeh}(h]h]h]h]h]uhhNh!jhKh jChhubhO)}(hUsage example:h]h0Usage example:}(hjEh jChhh!NhNubah}(h]h]h]h]h]uhhNh!jhK
h jChhubh
doctest_block)}(hX_>>> from dda.computing_elements import neg,int,mult
>>> from dda import State, symbols
>>> x, y, z = symbols("x, y, z")
>>> dda_state = State({x: int(y, 1, 1), y: mult(2,x), z: neg(int(z, 1, -1)) })
>>> py_state = to_scipy(dda_state)
>>> py_state.state # state has been linearized before processing
State({'int_1': Int(z), 'x': Int(y), 'y': mult(2, x), 'z': neg(int_1)})
>>> py_state.vars.evolved # evolved variables are therefore not [x,z] but [int_1,x]
['int_1', 'x']
>>> py_state.y0 # initial values
array([-1, 1])
>>> py_state.dt # same timestep for all integrals (but see note below)
1
>>> py_state.rhs(py_state.y0) # evaluation of f(y) on y0
array([-1, -2])
>>> y1 = py_state.rhs(py_state.y0) * py_state.dt # a single Euler integration timestep, for instance
>>> y1
array([-1, -2])
>>> sol = py_state.solve(10) # ODE integration with SciPy
>>> sol.t # integration went from 0->10 with 17 timesteps # doctest:+ELLIPSIS
array([ 0. , ..., 10. ])
>>> sol.y[:,-1] # the first solution is ~exp(+t)->inf, the second exp(-t)->0
array([-2.20269685e+04, 1.94334984e-08])
>>> from pylab import plot, legend, show # plotting example # doctest:+SKIP
>>> for i,fieldname in enumerate(py_state.vars.evolved): # doctest:+SKIP
plot(sol.t, sol.y[i], label=fieldname)
>>> legend(); show() # doctest:+SKIPh]h0X_>>> from dda.computing_elements import neg,int,mult
>>> from dda import State, symbols
>>> x, y, z = symbols("x, y, z")
>>> dda_state = State({x: int(y, 1, 1), y: mult(2,x), z: neg(int(z, 1, -1)) })
>>> py_state = to_scipy(dda_state)
>>> py_state.state # state has been linearized before processing
State({'int_1': Int(z), 'x': Int(y), 'y': mult(2, x), 'z': neg(int_1)})
>>> py_state.vars.evolved # evolved variables are therefore not [x,z] but [int_1,x]
['int_1', 'x']
>>> py_state.y0 # initial values
array([-1, 1])
>>> py_state.dt # same timestep for all integrals (but see note below)
1
>>> py_state.rhs(py_state.y0) # evaluation of f(y) on y0
array([-1, -2])
>>> y1 = py_state.rhs(py_state.y0) * py_state.dt # a single Euler integration timestep, for instance
>>> y1
array([-1, -2])
>>> sol = py_state.solve(10) # ODE integration with SciPy
>>> sol.t # integration went from 0->10 with 17 timesteps # doctest:+ELLIPSIS
array([ 0. , ..., 10. ])
>>> sol.y[:,-1] # the first solution is ~exp(+t)->inf, the second exp(-t)->0
array([-2.20269685e+04, 1.94334984e-08])
>>> from pylab import plot, legend, show # plotting example # doctest:+SKIP
>>> for i,fieldname in enumerate(py_state.vars.evolved): # doctest:+SKIP
plot(sol.t, sol.y[i], label=fieldname)
>>> legend(); show() # doctest:+SKIP}(hhh jSubah}(h]h]doctestah]h]h]jjuhjQh jChhh!jhK)ubj()}(hXDue to the way how widespread ODE integrators work, the per-integral
step size ``dt`` is required to be the same for every integration which is part
of the DDA system. That is, the following generates an error:
>>> from dda import dda, symbols
>>> a,b=symbols("a,b")
>>> state = State({ a: dda.int(a, 0.2, 0), b: dda.int(b, 0.5, 0) })
>>> to_scipy(state)
Traceback (most recent call last):
...
ValueError: Scipy requires all timesteps to be the same, however dt_(['a', 'b']) = [0.2 0.5]
Most high-level integrators available in scientific Python toolkits (such as scipy)
assume the overall system to have a single timestep size ``Δt`` (which is also quite
natural from a mathematical perspective). The signature ``dda.int(f,dt,ic)`` is thus
quirky from a mathematical or numerical viewpoint. It is written in such a way because
analog computing integrators have a tunable time scale ``k_0 ~= 1/dt`` which however
can also be consumed in the integrand itself: ``dda.int(f,1/k_0,ic) == dda.int(f/k_0,1,ic)``.
Furthermore, most high-level integrators do adaptive timestepping anyway. The fine-tuning
of timestep sizes is something which is only paid respect to in the :mod:`cpp_exporter`
module.h](hO)}(hDue to the way how widespread ODE integrators work, the per-integral
step size ``dt`` is required to be the same for every integration which is part
of the DDA system. That is, the following generates an error:h](h0ODue to the way how widespread ODE integrators work, the per-integral
step size }(hODue to the way how widespread ODE integrators work, the per-integral
step size h jfubhZ)}(h``dt``h]h0dt}(hhh joubah}(h]h]h]h]h]uhhYh jfubh0} is required to be the same for every integration which is part
of the DDA system. That is, the following generates an error:}(h} is required to be the same for every integration which is part
of the DDA system. That is, the following generates an error:h jfubeh}(h]h]h]h]h]uhhNh!jhK,h jbubjR)}(hX>>> from dda import dda, symbols
>>> a,b=symbols("a,b")
>>> state = State({ a: dda.int(a, 0.2, 0), b: dda.int(b, 0.5, 0) })
>>> to_scipy(state)
Traceback (most recent call last):
...
ValueError: Scipy requires all timesteps to be the same, however dt_(['a', 'b']) = [0.2 0.5]h]h0X>>> from dda import dda, symbols
>>> a,b=symbols("a,b")
>>> state = State({ a: dda.int(a, 0.2, 0), b: dda.int(b, 0.5, 0) })
>>> to_scipy(state)
Traceback (most recent call last):
...
ValueError: Scipy requires all timesteps to be the same, however dt_(['a', 'b']) = [0.2 0.5]}(hhh jubah}(h]h]j^ah]h]h]jjuhjQh jbubhO)}(hXMost high-level integrators available in scientific Python toolkits (such as scipy)
assume the overall system to have a single timestep size ``Δt`` (which is also quite
natural from a mathematical perspective). The signature ``dda.int(f,dt,ic)`` is thus
quirky from a mathematical or numerical viewpoint. It is written in such a way because
analog computing integrators have a tunable time scale ``k_0 ~= 1/dt`` which however
can also be consumed in the integrand itself: ``dda.int(f,1/k_0,ic) == dda.int(f/k_0,1,ic)``.h](h0Most high-level integrators available in scientific Python toolkits (such as scipy)
assume the overall system to have a single timestep size }(hMost high-level integrators available in scientific Python toolkits (such as scipy)
assume the overall system to have a single timestep size h jubhZ)}(h``Δt``h]h0Δt}(hhh jubah}(h]h]h]h]h]uhhYh jubh0N (which is also quite
natural from a mathematical perspective). The signature }(hN (which is also quite
natural from a mathematical perspective). The signature h jubhZ)}(h``dda.int(f,dt,ic)``h]h0dda.int(f,dt,ic)}(hhh jubah}(h]h]h]h]h]uhhYh jubh0 is thus
quirky from a mathematical or numerical viewpoint. It is written in such a way because
analog computing integrators have a tunable time scale }(h is thus
quirky from a mathematical or numerical viewpoint. It is written in such a way because
analog computing integrators have a tunable time scale h jubhZ)}(h``k_0 ~= 1/dt``h]h0k_0 ~= 1/dt}(hhh jubah}(h]h]h]h]h]uhhYh jubh0= which however
can also be consumed in the integrand itself: }(h= which however
can also be consumed in the integrand itself: h jubhZ)}(h.``dda.int(f,1/k_0,ic) == dda.int(f/k_0,1,ic)``h]h0*dda.int(f,1/k_0,ic) == dda.int(f/k_0,1,ic)}(hhh jubah}(h]h]h]h]h]uhhYh jubh0.}(hhh jubeh}(h]h]h]h]h]uhhNh!jhK8h jbubhO)}(hFurthermore, most high-level integrators do adaptive timestepping anyway. The fine-tuning
of timestep sizes is something which is only paid respect to in the :mod:`cpp_exporter`
module.h](h0Furthermore, most high-level integrators do adaptive timestepping anyway. The fine-tuning
of timestep sizes is something which is only paid respect to in the }(hFurthermore, most high-level integrators do adaptive timestepping anyway. The fine-tuning
of timestep sizes is something which is only paid respect to in the h jubh)}(h:mod:`cpp_exporter`h]hZ)}(hjh]h0cpp_exporter}(hhh jubah}(h]h](hpypy-modeh]h]h]uhhYh jubah}(h]h]h]h]h]refdoch refdomainjreftypemodrefexplicitrefwarnhjBhjhcpp_exporteruhhh!jhK?h jubh0
module.}(h
module.h jubeh}(h]h]h]h]h]uhhNh!jhK?h jbubeh}(h]h]h]h]h]uhj'h jChhh!jhNubh=)}(hhh]h}(h]h]h]h]h]entries](j,evaluate_const() (dda.scipy.to_scipy method)!dda.scipy.to_scipy.evaluate_consthNtauhhhhh!NhNubhZ)}(h``evaluation_default_values``h]h0evaluation_default_values}(hhh jGubah}(h]h]h]h]h]uhhYh j>ubh0: member (which also hold the initial
values for the first }(h: member (which also hold the initial
values for the first h j>hhh!NhNubhZ)}(h``rhs``h]h0rhs}(hhh jZubah}(h]h]h]h]h]uhhYh j>ubh0 evaluation). If you set }(h evaluation). If you set h j>hhh!NhNubhZ)}(h
``copy=True``h]h0 copy=True}(hhh jmubah}(h]h]h]h]h]uhhYh j>ubh0,
a shallow copy (which is equal to a deep copy for a dict holding floats)
is returned. In external calls, you should probably always set }(h,
a shallow copy (which is equal to a deep copy for a dict holding floats)
is returned. In external calls, you should probably always set h j>hhh!NhNubhZ)}(h
``copy=True``h]h0 copy=True}(hhh jubah}(h]h]h]h]h]uhhYh j>ubh0.}(hhh j>hhh!NhNubeh}(h]h]h]h]h]uhhNh!jhKh jhhubh)}(hXThe implementation of this function currently evaluates the (prepared) DDA
sytem by recursive calls with the help of a variable assignment directory. This is
basically a *run-time compilation* (JIT/VM) in pure python. Needless to say, this
won't give a great performance!
There are plenty of low-hanging fruits to provide optimized versions of this code:
One could call the efficient (but still scalar) C++ implementation which
:mod:`cpp_exporter` provides by `methods provided by Cython
`_.
One could also map the DDA abstract syntax tree (AST) to the python one and
use some unparser code to evaluate the DDA code as pure python
(see for instance
`Python: Modify AST and write back python code
`_).
For the time being, this code remains as a pure demonstration code.
Thanks to using the linearized state, there should be no troubles with call stack
overflows, however cyclic dependencies may not be properly resolved
and can result in infinite recursions (stack overflow).h](hO)}(hXThe implementation of this function currently evaluates the (prepared) DDA
sytem by recursive calls with the help of a variable assignment directory. This is
basically a *run-time compilation* (JIT/VM) in pure python. Needless to say, this
won't give a great performance!h](h0The implementation of this function currently evaluates the (prepared) DDA
sytem by recursive calls with the help of a variable assignment directory. This is
basically a }(hThe implementation of this function currently evaluates the (prepared) DDA
sytem by recursive calls with the help of a variable assignment directory. This is
basically a h jubj)}(h*run-time compilation*h]h0run-time compilation}(hhh jubah}(h]h]h]h]h]uhjh jubh0Q (JIT/VM) in pure python. Needless to say, this
won’t give a great performance!}(hO (JIT/VM) in pure python. Needless to say, this
won't give a great performance!h jubeh}(h]h]h]h]h]uhhNh!jhKh jubhO)}(hXrThere are plenty of low-hanging fruits to provide optimized versions of this code:
One could call the efficient (but still scalar) C++ implementation which
:mod:`cpp_exporter` provides by `methods provided by Cython
`_.
One could also map the DDA abstract syntax tree (AST) to the python one and
use some unparser code to evaluate the DDA code as pure python
(see for instance
`Python: Modify AST and write back python code
`_).h](h0There are plenty of low-hanging fruits to provide optimized versions of this code:
One could call the efficient (but still scalar) C++ implementation which
}(hThere are plenty of low-hanging fruits to provide optimized versions of this code:
One could call the efficient (but still scalar) C++ implementation which
h jubh)}(h:mod:`cpp_exporter`h]hZ)}(hjh]h0cpp_exporter}(hhh jubah}(h]h](hpypy-modeh]h]h]uhhYh jubah}(h]h]h]h]h]refdoch refdomainjreftypemodrefexplicitrefwarnhjhjhcpp_exporteruhhh!jhKh jubh0
provides by }(h
provides by h jubho)}(hj`methods provided by Cython
`_h]h0methods provided by Cython}(hmethods provided by Cythonh jubah}(h]h]h]h]h]namemethods provided by CythonhJhttps://cython.readthedocs.io/en/latest/src/userguide/external_C_code.htmluhhnh jubh
)}(hM
h]h}(h]methods-provided-by-cythonah]h]methods provided by cythonah]h]refurijuhh h#Kh jubh0.
One could also map the DDA abstract syntax tree (AST) to the python one and
use some unparser code to evaluate the DDA code as pure python
(see for instance
}(h.
One could also map the DDA abstract syntax tree (AST) to the python one and
use some unparser code to evaluate the DDA code as pure python
(see for instance
h jubho)}(h`Python: Modify AST and write back python code
`_h]h0-Python: Modify AST and write back python code}(h-Python: Modify AST and write back python codeh jubah}(h]h]h]h]h]name-Python: Modify AST and write back python codehwhttps://stackoverflow.com/questions/768634/parse-a-py-file-read-the-ast-modify-it-then-write-back-the-modified-source-cuhhnh jubh
)}(h{
h]h}(h],python-modify-ast-and-write-back-python-codeah]h]-python: modify ast and write back python codeah]h]refurij!uhh h#Kh jubh0).}(h).h jubeh}(h]h]h]h]h]uhhNh!jhKh jubhO)}(hXFor the time being, this code remains as a pure demonstration code.
Thanks to using the linearized state, there should be no troubles with call stack
overflows, however cyclic dependencies may not be properly resolved
and can result in infinite recursions (stack overflow).h]h0XFor the time being, this code remains as a pure demonstration code.
Thanks to using the linearized state, there should be no troubles with call stack
overflows, however cyclic dependencies may not be properly resolved
and can result in infinite recursions (stack overflow).}(hj<h j:ubah}(h]h]h]h]h]uhhNh!jhK h jubeh}(h]h]h]h]h]uhhh jhhh!jhNubeh}(h]h]h]h]h]uhjh jhhh!jhNubeh}(h]h]pyah]h]h]jjWjmethodjj[juhjhhh jCh!NhNubh=)}(hhh]h}(h]h]h]h]h]entries](j/reconstruct_state() (dda.scipy.to_scipy method)$dda.scipy.to_scipy.reconstruct_statehNtauhh>> ode = to_scipy(State({ Symbol("x"): Symbol("int")(Symbol("x"),0.1,1) }))
>>> y1 = ode.y0 + ode.rhs(ode.y0) * ode.dt # perform some euler integration step
>>> y1
array([0.9])h]h0>>> ode = to_scipy(State({ Symbol("x"): Symbol("int")(Symbol("x"),0.1,1) }))
>>> y1 = ode.y0 + ode.rhs(ode.y0) * ode.dt # perform some euler integration step
>>> y1
array([0.9])}(hhh j3
ubah}(h]h]j^ah]h]h]jjuhjQh j hhh!jZ hKubhO)}(hVUsually, you want to pass this function to some scipy integrator. See
also :meth:`ft`.h](h0KUsually, you want to pass this function to some scipy integrator. See
also }(hKUsually, you want to pass this function to some scipy integrator. See
also h jA
hhh!NhNubh)}(h
:meth:`ft`h]hZ)}(hjL
h]h0ft()}(hhh jN
ubah}(h]h](hpypy-metheh]h]h]uhhYh jJ
ubah}(h]h]h]h]h]refdoch refdomainjX
reftypemethrefexplicitrefwarnhj hjhftuhhh!jZ hK h jA
ubh0.}(hhh jA
hhh!NhNubeh}(h]h]h]h]h]uhhNh!jZ hK h j hhubeh}(h]h]h]h]h]uhjh j[ hhh!jp hNubeh}(h]h]pyah]h]h]jj}
jmethodjj
juhjhhh jCh!jZ hNubh=)}(hhh]h}(h]h]h]h]h]entries](j"rhst() (dda.scipy.to_scipy method)dda.scipy.to_scipy.rhsthNtauhh for the syntax).
This is a different approach then using the }(h> for the syntax).
This is a different approach then using the h j-
hhh!NhNubh)}(h:mod:`dda.cpp_exporter`h]hZ)}(hj]
h]h0dda.cpp_exporter}(hhh j_
ubah}(h]h](hpypy-modeh]h]h]uhhYh j[
ubah}(h]h]h]h]h]refdoch refdomainji
reftypemodrefexplicitrefwarnhjhNhdda.cpp_exporteruhhh!jhKh j-
ubh0 Instead
of code generation (and the need for a C++ compiler), this evaluates the
DDA file within python. The disadvantage is that this is damned slow, the
advantage is that the time integrator is much better then the selfmade one
in the }(h Instead
of code generation (and the need for a C++ compiler), this evaluates the
DDA file within python. The disadvantage is that this is damned slow, the
advantage is that the time integrator is much better then the selfmade one
in the h j-
hhh!NhNubh)}(h:mod:`dda.cpp_exporter`h]hZ)}(hj
h]h0dda.cpp_exporter}(hhh j
ubah}(h]h](hpypy-modeh]h]h]uhhYh j
ubah}(h]h]h]h]h]refdoch refdomainj
reftypemodrefexplicitrefwarnhjhNhdda.cpp_exporteruhhh!jhKh j-
ubh0[ module. And there is no need for a C++
compiler at all, all is (more or less) pure python.}(h[ module. And there is no need for a C++
compiler at all, all is (more or less) pure python.h j-
hhh!NhNubeh}(h]h]h]h]h]uhhNh!jhKh jhhubhO)}(hInvocation is like ``python -m dda.scipy --help`` anywhere from the system.
Run this to explore the usage of this command line interface.h](h0Invocation is like }(hInvocation is like h j
hhh!NhNubhZ)}(h``python -m dda.scipy --help``h]h0python -m dda.scipy --help}(hhh j
ubah}(h]h]h]h]h]uhhYh j
ubh0X anywhere from the system.
Run this to explore the usage of this command line interface.}(hX anywhere from the system.
Run this to explore the usage of this command line interface.h j
hhh!NhNubeh}(h]h]h]h]h]uhhNh!jhKh jhhubhO)}(hThe output will be CSV (file or stdout), in terms of one line per integration
step (called *dense solution* in scipy ODESolver language).h](h0[The output will be CSV (file or stdout), in terms of one line per integration
step (called }(h[The output will be CSV (file or stdout), in terms of one line per integration
step (called h j
hhh!NhNubj)}(h*dense solution*h]h0dense solution}(hhh j
ubah}(h]h]h]h]h]uhjh j
ubh0 in scipy ODESolver language).}(h in scipy ODESolver language).h j
hhh!NhNubeh}(h]h]h]h]h]uhhNh!jhKh jhhubeh}(h]h]h]h]h]uhjh jhhh!jhNubeh}(h]h]pyah]h]h]jj
jfunctionjj
juhjhhh h&h!jhNubeh}(h](hK*dda-scipy-interface-to-generic-ode-solversheh]h],dda scipy interface (to generic ode solvers)ah]h]uhh$h hhhh!h"hKexpect_referenced_by_name}expect_referenced_by_id}hhsubeh}(h]h]h]h]h]sourceh"uhhcurrent_sourceNcurrent_lineNsettingsdocutils.frontendValues)}(h)N generatorN datestampNsource_linkN
source_urlN
toc_backlinksentryfootnote_backlinksK
sectnum_xformKstrip_commentsNstrip_elements_with_classesN
strip_classesNreport_levelK
halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj,error_encodingutf-8error_encoding_error_handlerbackslashreplace
language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid
dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh"_destinationN
_config_files]pep_referencesNpep_base_url https://www.python.org/dev/peps/pep_file_url_templatepep-%04drfc_referencesNrfc_base_urlhttps://tools.ietf.org/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabledraw_enabledKsyntax_highlightlongsmart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform
docinfo_xformKsectsubtitle_xformembed_stylesheetcloak_email_addressesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}h]hasnameids}(scipyNjj
hhjjj4j1jjj+j(u nametypes}(jljNhjj4jj+uh}(hh&j
h&hKh
)}(hhh]h}(h]hKah]h]h]h]ismoduhh h!P/builds/software/pyanalog-mirror-from-github/dda/scipy.py:docstring of dda.scipyhKh h&hhubhhhhjj
jjjjj1j+j6j<jjjjj(j"jhjnjX j^ j
j
jbjhjju
footnote_refs}
citation_refs}
autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK
id_countercollectionsCounter}j:KsRparse_messages]hsystem_message)}(hhh]hO)}(h(Duplicate explicit target name: "scipy".h]h0,Duplicate explicit target name: “scipy”.}(hhh jubah}(h]h]h]h]h]uhhNh jubah}(h]h]h]h]h]halevelKtypeWARNINGsourcejlineKuhjh hubatransform_messages]transformerN
decorationNhhub.