How can I numerically solve the below equation, assume I have $K(z)$, the solution is in the $[0,L]$ domain, the conditions are: $A(0)=1, B(L)=1$ $$ 1. \frac{dA}{dz} = -K(z)A(z) - K(z)B(z) $$ $$ 2. \frac{dB}{dz} = -K(z)A(z) - K(z)B(z) $$


1 Answer 1


We can decouple the equations by defining the functions $F=A+B$ and $G=A-B$. Then


so that

$F(z)=F_0\exp\left[-2\int_0^z K(t)dt\right],\qquad G(z)=G_0,$

from which follows

$A(z)=\frac{1}{2}F_0\exp\left[-2\int_0^z K(t)dt\right]+\frac{1}{2}G_0, \qquad B(z)=\frac{1}{2}F_0\exp\left[-2\int_0^z K(t)dt\right]-\frac{1}{2}G_0.$

In order to determine $F_0$ and $G_0$, we use the boundary conditions $\left(\xi = e^{-2\int_0^L K(t)dt}\right)$

$A(0) = \frac{1}{2}F_0+\frac{1}{2}G_0 = 1,\qquad B(L) = \frac{1}{2}F_0\xi-\frac{1}{2}G_0 = 1$,

which yield

$F_0=\frac{4}{\xi +1}, \qquad G_0=\frac{2(\xi-1)}{\xi+1}.$

Use the numerical method of your choice to compute the integral $\int_0^z K(t)dt$.

  • 1
    $\begingroup$ Thank you very much Ricardo, that is very helpful. By the way if you are intrested in the physical background of this broblem, these equations stem from the coupled mode theory (CMT) of 2 modes (propagate and co-propagate) in a cylindric waveguide. $\endgroup$
    – asif evgy
    Apr 5, 2021 at 20:14
  • $\begingroup$ This is the first step of the problem, i trying to find a numerical solution for a system of first order coupled ODE, i posted a question here (math.stackexchange.com/questions/4090787/…). It will be great if you have something to share over there. $\endgroup$
    – asif evgy
    Apr 5, 2021 at 21:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .