# Comparison between CashKarp Method and Dormand Prince Method - Runge Kutta Method

Can Cash Karp Method be used for integrating a nonsmooth solution ?. Because Dormand Prince method gives an error while integrating nonsmooth solution

How can nonsmooth function can be integrated?

I am using MATLAB ODE45 for integration of my ordinary differential equation. q is a Column Vector of length 14.

Where excitation force on the right hand side varies in the following form

where {hp},{gp},{hg} and {gg} are column vectors of length 6

I call it nonsmooth because Fexcit varies with Fmf

The system of equations can be solved when Fmf=0, when Fmf is non zero Iam getting an warning which actually indicates that integration cannot be performed.

Warning/Error Message in Matlab

Warning: Failure at t=1.821477e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (3.552714e-15) at time t.

I did try ODE15S but the error appeared much earlier than ODE45. Both gave me same error

I use square brackets to represent matrices and curly braces to represent vectors.

• Can you be more explicit about what exactly is not smooth? – Wrzlprmft Nov 13 '16 at 7:17
• Please post the equations you're trying to solve and (exactly) the error you get. – David Ketcheson Nov 13 '16 at 13:58
• scicomp.stackexchange.com/questions/24998/… – Mathews24 Nov 13 '16 at 22:56
• What do the braces and brackets in your notation mean? If they are just normal brackets, why does $F_\text{excit}$ just have four components? — I call it nonsmooth because Fexcit varies with Fmf – I fail to see how this makes anything nonsmooth. – Wrzlprmft Nov 14 '16 at 17:58

You really have not provided enough information to diagnose the cause of your problem (e.g. I don't know if the dimension of your q-vector is two or two million) but guessing, based on your error message, I doubt it has anything to do with "smoothness" of the forcing function.

Generally, the way to debug these MATLAB ODE solvers when you get the error message you show is to repeat the analysis, stopping just before the failure time (e.g. 1.8 seconds). You want to save the solution at enough time steps so you can plot some of the key dependent variables as a function of time. I think it is very likely that one or more of these is going to plus or minus infinity near this final time.

The reason for this is most likely an error in your formulation or input to ode45.

A second possibility is that your system is inherently unstable.

A third possibility is that your system of ODE is stiff and that is causing problems for ode45. ode45 is not designed to solve stiff ODE systems. Changing to an ode solver with a different Runge-Kutta pair or some other explicit solver will not solve this problem. The MATLAB solver-of-choice for stiff systems of the form you show is ode15s.

• Can you explain what is smoothness of the forcing function ?, I was referring to a paper on ACM by Cash & Karp. If you have any inputs on the references to read that will be of great help – Srikumar Gopalakrishnan Nov 14 '16 at 20:05
• You were the one who mentioned smoothness of the forcing function. I simply said I doubted if that was the cause of the premature termination of ode45. I'm not that surprised you saw the same behavior with ode15s; stiffness was my third suggestion as to the cause of your problem. The fact that you see the same behavior with ode15s is good evidence that you won't see different behavior simply by changing the Runge-Kutta form slightly. – Bill Greene Nov 14 '16 at 20:27
• But the problem looks is due to the second possibility you stated. Is there any reference which explains about stability criteria for an iterative system. To ensure the stability the spectral radius of the system (max eigen value of the iterative sytem) should be less than one. How to determine the spectral radius of the forced vibration system which has damping in it ?, Any reference for this will be highly appreciated. – Srikumar Gopalakrishnan Nov 15 '16 at 4:07
• I don't know what you mean by "iterative system." Maybe you are confusing stability of a mechanical system with that of a numerical procedure. Most books on dynamical systems discuss stability. – Bill Greene Nov 15 '16 at 12:41
• If all of the matrices on the LHS of your equation are positive definite, your system will be stable. It is likely that it is the particular form of the excitation on the RHS that is causing the response to become very large. – Bill Greene Nov 15 '16 at 15:03