# Setting \`abstol\` and \`reltol\` when solving the Schrödinger equation with OrdinaryDiffEq

**URL:** <https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534>\
**Category:** Quantum\
**Tags:** question, ode\
**Created:** [February 4, 2025, 2:19pm UTC](https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534 "2025-02-04T14:19:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JonasWickman](https://avatars.discourse-cdn.com/v4/letter/j/9de0a6/32.png) [@JonasWickman](https://discourse.julialang.org/u/JonasWickman)\
**Post date:** [February 4, 2025, 3:00pm UTC](https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534/2 "2025-02-04T15:00:46Z")

</div>

The most immediate fix is to lower the relative tolerance:

```julia
ode_sol_direct = ode_solve(ode_problem_direct, ODE.Tsit5(); abstol=1e-12, reltol = 1e-10, saveat=tlist)

```

Typically, although I don’t think it affects the accuracy, there’s also no need to include the `saveat = tlist`. You can get get the values of the solution by interpolation by calling `ode_sol_direct(t)` after you’ve solved it.

This is not my area, but `Tsit5()` is probably not the best choice for solver for this problem, check the “Probelm Types” heading in the left bar of [DifferentialEquations.jl: Efficient Differential Equation Solving in Julia · DifferentialEquations.jl](https://docs.sciml.ai/DiffEqDocs/stable/) . I don’t remember Quantum Mechanics stuff well enough to figure out if any of those types would match up with your system.

---

_[View the full topic](https://discourse.julialang.org/t/setting-abstol-and-reltol-when-solving-the-schrodinger-equation-with-ordinarydiffeq/125534)._
