Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix example for stand-alone usage and remove old notebooks #49

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/source/without_pymc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ ODE might look like this::
After defining states, parameters and right-hand-side function we can create a
`SympyProblem` instance::

import sunode

problem = sunode.SympyProblem(
params=params,
states=states,
Expand All @@ -99,12 +101,13 @@ create a solver for no derivatives or with forward derivatives
(``sunode.Solver``), or a solver that can compute gradients using
the adjoint ODE (``sunode.AdjointSolver``).::

solver = sunode.solver.Solver(problem, compute_sens=False, solver='BDF')
solver = sunode.solver.Solver(problem, solver='BDF')

We can use numpy structured arrays as input, so that we don't need to
think about how the different variables are stored in the array.
This does not introduce runtime overhead.::

import numpy as np
y0 = np.zeros((), dtype=problem.state_dtype)
y0['hares'] = 1
y0['lynxes'] = 0.1
Expand All @@ -128,4 +131,4 @@ We can convert the solution to an xarray Dataset or access the
individual states as numpy record array::

solver.as_xarray(tvals, output).solution_hares.plot()
plt.plot(output.view(tvals, problem.state_dtype)['hares'])
plt.plot(tvals, output.view(problem.state_dtype)['hares'])
Loading
Loading