patrick-kidger / patrick-kidger/diffrax
Could you give an example of interactively step through a implicit solver?
Open
Nobody has claimed this yet.
feature
question
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
In this example, https://docs.kidger.site/diffrax/usage/manual-stepping/, how to replace the explicit solver with implicit ones? Here is my try, but got the following error:
import jax.numpy as jnp
import diffrax
from diffrax import ODETerm
vector_field = lambda t, y, args: -y
term = ODETerm(vector_field)
solver = diffrax.ImplicitEuler()
t0 = 0
dt0 = 0.05
t1 = 1
y0 = jnp.array(1.0)
args = None
tprev = t0
tnext = t0 + dt0
y = y0
state = solver.init(term, tprev, tnext, y0, args)
while tprev < t1:
y, _, _, state, _ = solver.step(term, tprev, tnext, y, args, state, made_jump=False)
print(f"At time {tnext} obtained value {y}")
tprev = tnext
tnext = min(tprev + dt0, t1)
The error message:
raise RuntimeError("Type of `other` not understood.")
RuntimeError: Type of `other` not understood.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the manual-stepping documentation page and run the reported Python snippet using diffrax. Compare the explicit example with the ImplicitEuler init and step calls, then document a working interactive implicit-solver example whose execution no longer raises the reported RuntimeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100