# DSolve, Simultaneous Eqns + Piece-wise + boundary and initial conditions

mathematica noobie here but could really use some help.

So I have 2 sets of equations: 1) w''''[x]=0 and 2) w''''[x]=q[x]

1) has conditions w[0]=0, w'[0]=0 2) has conditions w''[1]=0, w'''[1]=0

1) satisfies 0<=x<=b 2) satisfies b<=x<=H

Both equations must satisfy w[b/H]=w[b/H] where LHS is soln for 1) and RHS is soln from 2)

This also needs to hold for all derivatives up to 3. w'[b/H]=w'[b/H] etc etc I solved this on paper so I know what the answers and constants should be. I solved these equations separately on mathematica using DSolve and the initial conditions.. BUT here's where I need help.

1 Is it possible to make the 2 solutions equal to solve for the w[b/H] conditions to solve for the unknown constants ?

2 I also want to know if it's possible to solve this piece-wise by letting q[x] be 0 and then q0 for some constant.

1 I have no idea how to do it, and looking at some tips online hasn't helped.

2 However, I have included my attempt below but it still needs work. Especially for the w[b/H] terms.

If mathematica is not capable of solving this all at once then, oh well. Many thanks, Kenny

eqns = {w''''[x] == q[x],
q[x] == Piecewise[{{0, 0 <= x <= b}, {q0, b <= x <= H}}]};
ics = {w[0] == 0, w'[0] == 0, w''[1] == 0, w'''[1] == 0};
sol = DSolve[eqns, {w, q}, x]


Surely it can't be that easy right ?

• Your code suggests that q is constant q0, but your description suggests it varies as a function of x. I think you will get help with this problem, if people can understand what you are asking. – mikado Feb 27 '17 at 22:16
• What are $H$ and $h$?. Are you sure your right bc's are given in $x=1$ instead of $x=H$? – Pragabhava Feb 28 '17 at 0:15
• @mikado, just because q is a function of x it doesn't mean it has to have x in it. It can be constant. – KennyB Feb 28 '17 at 7:13
• @Pragabhava sorry that h is a typo it should be H. Those are going to be altered in manipulate plot. So for the equations they are arbitrary constants. Yes x = 1 is correct. – KennyB Feb 28 '17 at 7:13
• @KennyB Then, if $H < 1$, your problem isn't well defined. – Pragabhava Feb 28 '17 at 15:57

As the OP stated, $H > 1$ implies that $x=\tfrac{b}{H} < b$, where the solution of the problem can be proven to be smooth. This means that the continuity conditions at $x=\tfrac{b}{H}$ are automatically satisfied, and the only problem occurs at $x=b$.

Hence, the problem can be stated as $$w''''(x) = \begin{cases}0 & 0 < x < b \\ q(x) & b < x < 1 \end{cases},$$ with boundary conditions $$w(0) = 0, \qquad w'(0) = 0, \qquad w''(1) = 0, \qquad w'''(1) = 0,$$ and continuity conditions $$w(b^-) = w(b^+), \quad w'(b^-) = w'(b^+), \quad w''(b^-) = w''(b^+), \quad w'''(b^-) = w'''(b^+).$$ This can be explicitly solved (modulo an integral) by taking $$w(x) = \begin{cases} u(x) & 0 < x < b \\ v(x) & b < x < 1 \end{cases}.$$ Then, $$u(x) = a_1 x^3 + a_2 x^2 \qquad\qquad\qquad\qquad\quad\qquad (0 < x < b)$$ and $$v(x) = a_3 x + a_4 + \frac{1}{6}\int_x^1 \left(t-x\right)^3 q(t) dt. \qquad (b < x < 1)$$

Finally, we can use the continuity conditions to completely determine the solution:

\begin{align} u(x) &= \int_b^1 \left(\tfrac{x^2 t}{2} - \tfrac{x^3}{6}\right)q(t)dt,\\ v(x) &= \int_b^1 \left(\tfrac{x t^2}{2}-\tfrac{t^3}{6}\right)q(t) dt + \int_x^1 \tfrac{(t-x)^3}{6} q(t) dt. \end{align}

In my machine (v.11.0.1.0), the code

DSolve[{w''''[x] == HeavisideTheta[x - b] q[x], w[0] == 0, w'[0] == 0,
w''[1] == 0, w'''[1] == 0}, w, x]


fails to produce a result (with or without Assumptions -> 0 < b < 1 and interval specification {x,0,1}), and I haven't seen the end of

DSolve[{w''''[x] == Piecewise[{{0, 0 < x < b}, {q[x], b < x < 1}}],
w[0] == 0, w'[0] == 0, w''[1] == 0, w'''[1] == 0}, w, {x, 0, 1},
Assumptions -> 0 < b < 1]


as it takes forever, but

DSolve[{u''''[x] == 0, v''''[x] == q[x], u[0] == 0, u'[0] == 0,
v''[1] == 0, v'''[1] == 1, u[b] == v[b], u'[b] == v'[b],
u''[b] == v''[b], u'''[b] == v'''[b]}, {u, v}, x]


produces the correct result (I leave the verification to the OP).

If $q(x) = q_0$, Mathematica is perfectly capable of finding a solution:

In[1]:= DSolve[{w''''[x] == Piecewise[{{0, 0 < x < b}, {q0, b < x < 1}}],
w[0] == 0, w'[0] == 0, w''[1] == 0, w'''[1] == 0}, w, {x, 0, 1},
Assumptions -> 0 < b < 1]
Out[1]:= {{w -> Function[{x}, 1/24 q0 (b^4 - 4 b^3 x + x^2 (6 - 4 x + x^2) -
(b - x)^4 UnitStep[b - x])]}}


Another form:

In[2]:= DSolve[{w''''[x] == UnitStep[x - b] q[x], w[0] == 0, w'[0] == 0,
w''[1] == 0, w'''[1] == 0}, w, {x, 0, 1}, Assumptions -> 0 < b < 1] // FullSimplify
Out[2]:= {{w -> Function[{x}, 1/24 q0 (b^4 - 4 b^3 x + x^2 (6 - 4 x + x^2) -
(b - x)^4 UnitStep[b - x])]}}

• you are a coding genius !! Exactly what I was looking for, since in other cases I have q[x] taking on many values and eventually will be based on x as well. But I am confident in my abilities to change the code as required. Just the way to use DSolve for this problem had me stumped. – KennyB Mar 1 '17 at 5:35
• Also I must give credit into splitting up w into u and v to see the correct results. I didn't even think about this approach in mathematica. Definitely changed my thinking in terms of coding. – KennyB Mar 1 '17 at 5:42
• @KennyB Glad to hear :) – Pragabhava Mar 1 '17 at 11:43