Skip to content

Commit 3c892f2

Browse files
astoerikoaseyboldt
authored andcommitted
Fix example for usage without Pytensor
1 parent e91aedd commit 3c892f2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/source/without_pymc.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ ODE might look like this::
8585
After defining states, parameters and right-hand-side function we can create a
8686
`SympyProblem` instance::
8787

88+
import sunode
89+
8890
problem = sunode.SympyProblem(
8991
params=params,
9092
states=states,
@@ -99,12 +101,13 @@ create a solver for no derivatives or with forward derivatives
99101
(``sunode.Solver``), or a solver that can compute gradients using
100102
the adjoint ODE (``sunode.AdjointSolver``).::
101103

102-
solver = sunode.solver.Solver(problem, compute_sens=False, solver='BDF')
104+
solver = sunode.solver.Solver(problem, solver='BDF')
103105

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

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

130133
solver.as_xarray(tvals, output).solution_hares.plot()
131-
plt.plot(output.view(tvals, problem.state_dtype)['hares'])
134+
plt.plot(tvals, output.view(problem.state_dtype)['hares'])

0 commit comments

Comments
 (0)