NDSolve works for complex valued ODE initial value problems (IVP). However, for a simple boundary value problem (BVP) with complex coefficients it fails:
NDSolve[{x''[t] + (1 + I) Sin[x[t]] == 0, x[0] == 1, x[10] == 0}, x, {t, 0, 10}]
FindRoot::trcx: The search has encountered a complex value and the trust region step control method is only implemented for real values.
The difficulty seems to be that the internal call to FindRoot to solve the shooting method matching is trying a method (trust region step control) that is not implemented for complex numbers.
I would like to get around this by somehow telling FindRoot to use line search instead. Since there does not appear to be a way to pass this through the NDSolve options to FindRoot, I tried globally resetting the default FindRoot options:
SetOptions[FindRoot, Method -> {"Newton", "StepControl" -> "LineSearch"}]
However, a subsequent call to NDSolve returned the same error as before, i.e., a complaint about trust region step control. So it didn't use linear search!
So, my questions are:
- Is there a way to pass options through NDSolve to FindRoot?
- Why doesn't the call to SetOptions work?
- Is there another way to get Mathematica to solve a complex BVP? (Yes, I know I can always split the equation into real and imaginary parts, but this is rather inconvenient for the much more complicated problems I'm actually trying to solve. Besides, as a matter of principle, since Mathematica generally handles complex variables seamlessly, it seems there should be a more direct way to do this.)
{}
button above the edit window. The edit window help button?
is also useful for learning how to format your questions and answers. You may also find this meta Q&A helpful $\endgroup$