# Solving a higher index DAE formulating it as a DAEProblem

I’m trying to solve a higher index DAE (say in my case index 3) system of equations formulating it directly as a DAEProblem without converting it into an ODEProblem.

Going through the documentation I could find only examples that utilizes index reduction in modelingtoolkit.jl and further solving it as an ODEProblem. I’m looking further into solving it as a DAEProblem.

Is there a possible way to do that ? If so, with what solvers ?

Here is a simple case of equations of pendulum where we encounter a DAE system of index 3. The code below gives me an error message ‘convergence failure’ as I have directly attempted to solve it without index reduction. Can I get any possible help to reduce its index and further solving it as a DAEProblem ?

``````using DifferentialEquations, ModelingToolkit

function f(out, da, a, p, t)
(L, m, g) = p
u, v, x, y, T = a
du, dv, dx, dy, dT = da
out[1] = x*T/(m*L) - du
out[2] = y*T/(m*L) - g - dv
out[3] = u - dx
out[4] = v - dy
out[5] = u^2 + v^2 - L^2
nothing
end

u0 = zeros(5)
u0[3] = 1.0
du0 = zeros(5)
du0[2] = 9.81

p = [1,1,9.8]
tspan = (0.,100.)
differential_vars = [true, true, true, true, false]

prob = DAEProblem(f, du0, u0, tspan, p, differential_vars = differential_vars)
Just call `DAEProblem` from ModelingToolkit on the sys. It can generate an ODEProblem, ODAEProblem, and the DAEProblem forms. You’ll need the MTK structural simplification to do the index reduction.