-
Notifications
You must be signed in to change notification settings - Fork 3
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
complex domain problems #31
Comments
That's just because we copied the docstrings from SciPy. It doesn't seem that straightforward to directly support complex numbers. If the RHS function is already defined using complex numbers, you could wrapping as in the following example: import nbkode
import numba
import numpy as np
@numba.njit
def complex_f(t, y):
return -1j * y
@numba.njit
def f(t, y):
y = y.view(np.complex_)
dy = complex_f(t, y)
return dy.view(np.float_)
t0 = 0
y0 = np.array([1.0 + 1.0j], dtype=np.complex_)
solver = nbkode.RungeKutta45(f, t0, y0.view(np.float_))
t, y = solver.step(n=5)
y = y.view(np.complex_) |
Thanks! I was looking at just splitting up the equations into real and imaginary parts, but for a large complex system your wrapping will be far more convenient. Happy to PR for the docstrings otherwise feel free to close this issue. |
The docstrings of the RungeKutta solvers indicate that they can be applied in the complex domain.
However a complex initial state y0 is cast to float by the Solver class (core.py L141).
Is integration in the complex domain supported?
The text was updated successfully, but these errors were encountered: