So I have a problem where I'm trying to solve some differential equations with split boundary conditions and have ran into some problems.

Firstly I define some parameters:

λi = 2; r0 = {-100, 500}; r1 = {300, 300}; u = {0, -1}; v = {1/Sqrt[2], 1/Sqrt[2]};

Then I start from a Lagrangian:

L = Sqrt[x'[s]^2 + y'[s]^2] + λ (x'[s]*y''[s] -y'[s]*x''[s])^2/(x'[s]^2 + y'[s]^2)^3

and then generate two coupled differential equations:

eq1 = D[D[L, x'[s]], s] == D[D[L, x''[s]], {s, 2}] // FullSimplify
eq2 = D[D[L, y'[s]], s] == D[D[L, y''[s]], {s, 2}] // FullSimplify

which are very long and unpleasant to look at, but I'd like to be able to obtain a numerical solution with the following boundary conditions:

bc1 = x[0] == r0[[1]];
bc2 = x[1] == r0[[2]];
bc3 = y[0] == r1[[1]];
bc4 = y[1] == r1[[2]];
bc5 = x'[0] == u[[1]] *Sqrt[x'[0]^2 + y'[0]^2];
bc6 = x'[1] == v[[1]] *Sqrt[x'[1]^2 + y'[1]^2];
bc7 = y'[0] == u[[2]] * Sqrt[x'[0]^2 + y'[0]^2];
bc8 = y'[1] == v[[2]]*Sqrt[x'[1]^2 + y'[1]^2];

However when I try using NDSolve:

NDSolve[{eq1 , eq2, bc1, bc2, bc3, bc4, bc5, bc6, bc7, bc8} /. λ -> λi, {x, y}, {s, 0, 1}]

I get the errors:

NDSolve::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations.

NDSolve::bvdae: Differential-algebraic equations must be given as initial value problems.

I tried to adapt an answer here and use parametricNDSolve to provide an initial value problem:

parSol2 = ParametricNDSolve[{eq1, eq2, bc1, bc3, bc5, bc7, x''[0] == xdd0, y''[0] == ydd0, 
    x'''[0] == xddd0, y'''[0] == yddd0}, {x, y}, {s, 0, 1}, {xdd0, ydd0, xddd0, yddd0}]

which works but then trying to solve for the root doesn't work, i.e.:

FindRoot[{bc2, bc4, bc6, bc8} /. {x -> x[xdd0, ydd0, xddd0, yddd0], 
    y -> y[xdd0, ydd0, xddd0, yddd0]} /. parSol // Evaluate, 
    {{xdd0, 0.1}, {ydd0, 0.1}, {xddd0, 0.1}, {yddd0, 0.1}}]

probably because I'm not providing a good initial guess (but I'm not sure how to go about improving this really with a 4 dimensional problem). Any suggestions?

  • $\begingroup$ bc5 through bc8 are 4 eq with 4 unknowns, which if consistent, you could solve for the derivatives separate from the diffeqs. Other than x'[0], you can't. $\endgroup$
    – Bill Watts
    Dec 10, 2017 at 3:33
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Dec 11, 2017 at 2:55

1 Answer 1


NDSolve cannot solve the equations in the question, because they are ill-posed as written. As suggested by the first error message cited in the question, it cannot obtain expressions for the fourth derivatives of x and y. Specifically,

Solve[{eq1, eq2}, {x''''[s], y''''[s]}]
(* {} *)

So, there is no solution for {x''''[s], y''''[s]}. To see why this is so, extract the coefficients of these derivatives.

CoefficientArrays[Subtract @@@ {eq1, eq2}, {x''''[s], y''''[s]}] // Last;
Simplify[Normal[%]/(x'[s]^2 + y'[s]^2)/(2 λ)]
(* {{y'[s]^2, -x'[s] y'[s]}, {x'[s] y'[s], -x'[s]^2}} *)

(* 0 *)

This suggests that an algebraic identity may exist among the dependent variables or their derivatives. In any case, the difficulty lies with the mathematics of the problem, not with its attempted Mathematica solution.

  • 1
    $\begingroup$ Yes, you can't uncouple $x$ and $y$ here. Your highest order terms are derivatives of the curvature. I'd suggest you work with stretch and curvature as your variables instead. $\endgroup$
    – SPPearce
    Dec 11, 2017 at 14:31
  • 1
    $\begingroup$ I think you dropped a minus sign in your output from Simplify; the first component should be -y'[s]^2. (The matrix you have in your answer currently is non-singular in general.) $\endgroup$ Dec 11, 2017 at 15:08
  • $\begingroup$ @MichaelSeifert Indeed, I did. Typo corrected now. Thanks. $\endgroup$
    – bbgodfrey
    Dec 11, 2017 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.