Message Boards Message Boards

Avoid the warning message while using DSolve?

Posted 7 years ago

Use DSolve, and there appears warning info. Would you like to teach me how to deal with this situation and get a reliable solution? Thanks.

In[45]:= eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (
   E^((lh - x) /Sqrt[Dc ] Sqrt[s + \[Theta]c]) F1 Sqrt[
    Dc ] \[Lambda])/
   Sqrt[ (s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
   cinf \[Theta]c \[Lambda] -> A2}

Out[45]= A2/(s + \[Theta]c) - (
 A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[s + \[Theta]c]

In[46]:= eq13 = s *q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0

Out[46]= -pinf + A2/(s + \[Theta]c) - (
  A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[
  s + \[Theta]c] + s q[x, s] - Dp 
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(", 
RowBox[{"2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, s] == 0

In[47]:= eq15 = (D[q[x, s], x] /. x -> +\[Infinity]) == 0

Out[47]= 
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(", 
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[\[Infinity], s] == 0

In[48]:= eq40 = 
 Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
     Dc > 0 && \[Alpha]1 > 0, 
    DSolve[{eq13, eq15}, q[x, s], {x, s}, 
     GeneratedParameters -> B3 ]] // Simplify // Normal

\:6B63\:5728\:8BA1\:7B97In[48]:= DSolve::bvsing: Unable to resolve some of the arbitrary constants in the general solution using the given boundary conditions. It is possible that some of the conditions have been specified at a singular point for the equation. >>

Out[48]= {{q[x, 
    s] -> (E^(-(Sqrt[s]/Sqrt[Dp] + Sqrt[s/
          Dp]) x) (-(E^((2 Sqrt[s] x)/Sqrt[Dp]) + E^(
            2 Sqrt[s/Dp] x)) Sqrt[
         Dp s (s + \[Theta]c)] (-Dc s + Dp (s + \[Theta]c)) (-A2 + 
           pinf (s + \[Theta]c)) + 
        A1 Dc E^((lh - x) Sqrt[(s + \[Theta]c)/Dc]) Sqrt[
         Dp s] (s + \[Theta]c) (E^((2 Sqrt[s] x)/Sqrt[
            Dp]) (s - Dp Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc]) + 
           E^(2 Sqrt[s/Dp]
              x) (s + Dp Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc])) - 
        2 Dp E^(Sqrt[s/Dp] x) s Sqrt[s/Dp] (s + \[Theta]c)^(
         3/2) (-Dc s + Dp (s + \[Theta]c)) B3[2][s]))/(2 Dp^2 (s/Dp)^(
      3/2) (s + \[Theta]c)^(3/2) (Dc s - Dp (s + \[Theta]c)))}}
POSTED BY: Jacques Ou
7 Replies
Posted 7 years ago

Dear Gianluca, I get it. First solve eq13 and then apply the infinite boundary condition to the eq13. Thanks.

POSTED BY: Jacques Ou

This solve the equation eq13 and then calculates the boundary value:

Clear[q, x, s];
eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh - x)/
           Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
     Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
    cinf \[Theta]c \[Lambda] -> A2};
eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0;
sol = q /. 
   Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
     Dc > 0 && \[Alpha]1 > 0, First@DSolve[eq13, q, {x, s}]];
q[x_, s_] = 
  Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
    Dc > 0 && \[Alpha]1 > 0, 
   Collect[Expand@(sol[x, s]), {E^(Sqrt[s/Dp] x), E^(-Sqrt[(s/Dp)] x),
      E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, 
    Composition[FullSimplify, ExpandDenominator, Cancel]]];
Assuming[s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
  Dc > 0 && \[Alpha]1 > 0,
 Limit[D[q[x, s], x], x -> +\[Infinity]]]

The result is \[Infinity] C[1][s]. This is zero when C[1][s] is zero. Your solution that satisfies the boundary condition is

qSol[x_, s_] = q[x, s] /. C[1][s] -> 0
Simplify[eq13 /. q -> qSol, Dc > 0]
Assuming[s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
  Dc > 0,
 Limit[D[qSol[x, s], x], x -> +\[Infinity]] == 0]
POSTED BY: Gianluca Gorni

Hello, Gianluca, I changed your codes a little since 'DSolveValue' and 'Expand@sol[x, s]' didn't pass. Would you like to check the following codes again? Thanks for your help.

eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh - x)/
          Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
    Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
   cinf \[Theta]c \[Lambda] -> A2}
eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0
sol = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
    Dc > 0 && \[Alpha]1 > 0, DSolve[eq13, q, {x, s}]]
eq15 = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
    Dc > 0 && \[Alpha]1 > 0, 
  Collect[Expand@(q[x, s] /. sol[[1]]), {E^(Sqrt[s/Dp] x), 
    E^(-Sqrt[(s/Dp)] x), E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, 
   Composition[FullSimplify, ExpandDenominator, Cancel]]]
eq16 = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
      Dc > 0 && \[Alpha]1 > 0, ExpandAll[eq15, x]] // Simplify // 
  Normal
POSTED BY: Gianluca Gorni

eq13 is a boundary condition at infinity, which Mathematica has difficulty solving automatically. I suggest solving eq13 first, and then using the result in eq13. Try this version of the code:

eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh - x)/
           Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
     Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
    cinf \[Theta]c \[Lambda] -> A2};
eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0;
sol = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
     Dc > 0 && \[Alpha]1 > 0, DSolveValue[eq13, q, {x, s}]];
Collect[Expand@sol[x, s], {E^(Sqrt[s/Dp] x), E^(-Sqrt[(s/Dp)] x), 
  E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, 
 Composition[Simplify, ExpandDenominator]]
POSTED BY: Gianluca Gorni
Posted 7 years ago

Hello, Gianluca, I changed your codes a little since 'DSolveValue' and 'Expand@sol[x, s]' didn't pass. Would you like to check the following codes again? Thanks for your help.

eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh - x)/
          Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
    Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
   cinf \[Theta]c \[Lambda] -> A2}
eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0
sol = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
    Dc > 0 && \[Alpha]1 > 0, DSolve[eq13, q, {x, s}]]
eq15 = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
    Dc > 0 && \[Alpha]1 > 0, 
  Collect[Expand@(q[x, s] /. sol[[1]]), {E^(Sqrt[s/Dp] x), 
    E^(-Sqrt[(s/Dp)] x), E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, 
   Composition[FullSimplify, ExpandDenominator, Cancel]]]
eq16 = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
      Dc > 0 && \[Alpha]1 > 0, ExpandAll[eq15, x]] // Simplify // 
  Normal
POSTED BY: Jacques Ou
Posted 7 years ago

Dear Gianluca, I want to solve eq13 and eq15 rather than only eq13. I ran your codes and it didn't work well.

In[15]:= eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh -
             x)/Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
    Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
   cinf \[Theta]c \[Lambda] -> A2}


Out[15]= A2/(s + \[Theta]c) - (
 A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[s + \[Theta]c]

In[16]:= eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0


Out[16]= -pinf + A2/(s + \[Theta]c) - (
  A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[
  s + \[Theta]c] + s q[x, s] - Dp 
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(", 
RowBox[{"2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, s] == 0

In[17]:= sol = 
 Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
   Dc > 0 && \[Alpha]1 > 0, DSolveValue[eq13, q, {x, s}]]


Out[17]= DSolveValue[-pinf + A2/(s + \[Theta]c) - (
   A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[
   s + \[Theta]c] + s q[x, s] - Dp 
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(", 
RowBox[{"2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, s] == 0, q, {x, s}]

In[18]:= Collect[
 Expand@sol[x, s], {E^(Sqrt[s/Dp] x), E^(-Sqrt[(s/Dp)] x), 
  E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, Simplify@*ExpandDenominator]

\:6B63\:5728\:8BA1\:7B97In[18]:= Syntax::sntxf: "Simplify@" cannot be followed by "*ExpandDenominator".

\:6B63\:5728\:8BA1\:7B97In[18]:= Syntax::tsntxi: "Simplify@" is incomplete; more input is needed.

\:6B63\:5728\:8BA1\:7B97In[18]:= Syntax::sntxi: Incomplete expression; more input is needed .
POSTED BY: Jacques Ou

I would try this way:

eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (E^((lh - x)/
           Sqrt[Dc] Sqrt[s + \[Theta]c]) F1 Sqrt[Dc] \[Lambda])/
     Sqrt[(s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1, 
    cinf \[Theta]c \[Lambda] -> A2};
eq13 = s*q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0;
sol = Assuming[(lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 &&
     Dc > 0 && \[Alpha]1 > 0, DSolveValue[eq13, q, {x, s}]];
Collect[Expand@sol[x, s], {E^(Sqrt[s/Dp] x), E^(-Sqrt[(s/Dp)] x), 
  E^((lh - x) Sqrt[(s + \[Theta]c)/Dc])}, Simplify@*ExpandDenominator]

From the expression, you let x go to infinity and find the arbitrary functions C[1][s] and C[2][s] that satisfy your boundary condition.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract