Register to reply 
Mathematica: NDSolve question 
Share this thread: 
#1
Oct2311, 11:56 PM

P: 16

I am solving a PDE using NDSolve. It always give a message like:
"For the method`IDA, only machine real code is available. Unable to continue with complex values or beyond floatingpoint exceptions." What does this mean? My code is as following. NDSolve[{∂_{t} S[z, t] == I z S[z,t] I A[z,t], ∂_{t} A[z, t] == I S[z,t] , S[z, 0] == 0, S[0, t] == I t^{2} /2, A[z, 0] == 0, A[0, t] == t}, {S,A}, {t, 0, 1}, {z, 0, 1}, MaxSteps > 10^{^6} ] Any suggestions? Please Help! 


#2
Oct2411, 10:33 AM

P: 1,037

This http://reference.wolfram.com/mathema...IDAMethod.html indicates that one of the possible methods available for numerical solution of differential equations is the IDA method. Either someone didn't implement handling of PDE with complex values or it is not possible to implement handling of complex values. That is what the error message is telling you.
This http://reference.wolfram.com/mathema...f/NDSolve.html (when you click on the orange "More Information" box and scroll down until you find Method) shows you that you can explicitly tell it it what method to use. You might try giving NDSolve an option of Method>"Adams" or one of the other methods and see if one of those will sidestep IDA and happily accept complex values. I don't have your functions so I have not actually tested this. 


#3
Oct2411, 11:26 AM

P: 16

Bill: Those Method options are not available somehow. It is strangethe second link you provided says explicitly that "The differential equations in NDSolve can involve complex numbers. "
BTW, the above is the complete code. No additional functions are used. Although it is not the original equations I wanted to solve. I want to use this simple example to test NDSolve. Yet it doesn't work. 


#4
Oct2411, 03:53 PM

PF Gold
P: 471

Mathematica: NDSolve question
When I put in your code:



#5
Oct2411, 04:26 PM

P: 16

Hepth: Yes it works! That's weird! Though I did not perform an analytic sln to check, but at the plot of the result looks well behaved. Thanks a lot!



#6
Oct2411, 06:21 PM

P: 1,666

I don't think that's all quite right. For one thing, use lowercase letters for userdefined variable names. Also, I don't thing you're specifying enough boundary conditions so Mathematica is just inserting artificial ones. The boundary condtionss at the initial t=0 should agree. Also, looks like the solutions are just zero up there.
I would recommend giving boundary conditions on both sides (t=0 and t=1) and an initial conditions a(z,0)=f(z), s(z,0)=g(z). This is how I'd code it. I just inserted some reasonable boundary and initial conditions:



#7
Oct2411, 08:16 PM

P: 16

Jack: Thanks a lot for the suggestions! About the boundary conditions, I find that if I eliminate S[z, 0] == 0 then Mathematica will work. If I add it, and in addition do as Hepth suggested, it also works. Now in your reply, 6 conditions are specified. Is there any way to justify Mathematica's approximation when there could be a lack of boundary conditions? Because in some cases, it is not possible to know all the boundary conditions.



#8
Oct2511, 06:29 AM

P: 1,666

I don't know how Mathematica determines default boundary conditions. However, seems to me if you don't have all the boundary conditions, then the system is illposed meaning the solution is not unique. But I'm practical: if you can get it to work to get an answer that you feel is correct then that's good enough for me. :)



#9
Oct2511, 10:32 AM

P: 16

Jack, thank you for the help and comment!



Register to reply 
Related Discussions  
Mathematica NDsolve error, ndode?  Math & Science Software  4  
NDSolve in mathematica  Differential Equations  6  
Mathematica NDSolve  Differential Equations  2  
Mathematica NDSolve  Math & Science Software  1  
Mathematica: ODE, NDSolve  Math & Science Software  0 