1
$\begingroup$

I'm trying to numerically solve a system of second order differentials equations that are connected only by boundary conditions. I can't figure out how to define the problem in mathematica.

The first equation:

$y_1''(x) = k_1*Sinh(y_1(x)) - c_1(x)$, is defined on $0<x\leq d$

The second equation:

$y_2''(x) = k_2*Sinh(y_2(x)) - c_2(x)$, is defined on $d<x<\infty$

Boundary conditions are:

$y_1'(0) = 0$

$y_2(\infty) = 0$

$y_1(d^-) = y_2(d^+)$

$\epsilon_1y_1'(x)|_{x=d^-} = \epsilon_2y_2'(x)|_{x=d^+}$

$k_1$, $k_2$, $\epsilon_1$, $\epsilon_2$, $c_1(x)$, $c_2(x)$ are given constants/functions. Can you please help to define and solve the system in mathematica ? I tried the following code, where put constant values for all parameters:

c1 = 1; 
c2 = 1; 
k1 = 1; 
d = 1; 
e1 = 1; 
e2 = 1; 
system = {Derivative[2][y1][x1] == k1*Sinh[y1[x1]] - c1, 
   Derivative[2][y2][x2] == k2*Sinh[y2[x2]] - c2, y2[Infinity] == 0, 
   Derivative[1][y1][0] == 0, y1[d] == y2[d], e1*Derivative[1][y1][d] == 
    e2*Derivative[1][y2][d]}
s1 = NDSolve[system, {y1[x1], y2[x2]}, {x1, 0, d}, {x2, d, Infinity}]

However I get

NDSolve::allort: "The dependent variable y1[x1] should depend either on the temporal variable alone or on all independent variables."

Can't understand what can be the problem.

$\endgroup$

closed as off-topic by Karsten 7., MarcoB, Michael E2, bbgodfrey, m_goldberg May 13 '17 at 21:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Karsten 7., MarcoB, Michael E2, bbgodfrey, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) 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. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Aug 15 '16 at 12:40
  • 1
  • 2
    $\begingroup$ People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. $\endgroup$ – user9660 Aug 15 '16 at 12:42
  • $\begingroup$ I do not think this is well posed. You have basically only 3 boundary conditions, not 4. You need 4. The condition that $y_1[d]=y_2[d]$ does not add anything new. To find $y_2[d]$ you need to solve second ODE. But to solve second ODE you need $y_1[d]$ first, which requires solving the first ODE first. But to solve the first ode, you need $y_2[d]$, which requires solving the second ODE first. And so on. $\endgroup$ – Nasser Aug 15 '16 at 15:47
  • 2
    $\begingroup$ Please add a value for k2. $\endgroup$ – bbgodfrey May 13 '17 at 14:01