DifferentialEquations.jl: Complex function results in Inexact Error

I am trying to solve a one dimensional Schrödinger equation which has been reduced to a first-order linear ODE of the kind \psi’(x) = f(x) \psi(x), where all functions have complex args (Complex{Float64}) I believe.

Either way, the solver (solve(::ODEProblem)) seems to be having a hard time dealing with the complex numbers because it spits out an Inexact Error. If I change the ode and take the absolute value of both sides, it does not complain…

So does anyone know what kind of setting of the solver I need to change to allow complex numbers?

Ty in advance…

Welcome @ess3sq! Please post a minimal working example when asking for help:

Having said this, are you initializing your variables (in the IC) as complex, floating-point numbers?

1 Like

Thanks for replying this quickly;

I was not aware of the guideline, but I currently do not have a satisfying working example because I probably used it wrong with complex functions.

About your question, I did in fact not make the initial conditions complex, I shall try that in a moment. For now just the wave function and the parameters are complex.

1 Like

You’re right, it doesn’t need to be a “working” example but an example which shows the error you’re running into. And it should be minimal, don’t just copy paste your 200 line script.

Fair enough, I will update the question in a bit.

Without seeing any code it’s hard to tell. But I would guess your initial condition was given as real numbers instead of complex numbers.