# How to impose an integral conservation in solving ODEs boundary value problems (BVP)?

I have a system of coupled ODEs that I want to solve. The functions are A(x), B(x), C(x). It is a boundary values problem. I am using Matlab bvp4c.

So far I am not satisfied with my solutions. For the boundaries that are of interest for me, the solver fail (Matlab return "a singular Jacobian encountered"). For some other boundaries, the result depend of the initial guess. So I think that my system is ill defined. I am thinking of adding one constraint but I don't find how to implement it

How to enforce $\int_{a}^{b}d x(A(x)+B(x)+C(x))=N$ ?

then $I(a) = 0$, $I(b) = N$, $\dot{I}(x) = A(x) + B(x) + C(x)$, and you have another boundary value problem that you can solve in MATLAB using bvp4c.
• Is the condition $I(a)=0$ necessary? Since $I(x)=\int_{a}^{x} (A(s)+B(s)+C(s)) ds$, then $I(a)=0$ comes by definition so it should not be required. I am asking this because I have now a system with too many boundary conditions since I added only one equation of first order but with two additional constraints ($I(a)$ and $I(b)$) – David Dec 23 '14 at 14:33