Message Boards Message Boards

0
|
3818 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Get solution that satisfies the equation?

Posted 7 years ago

The codes are

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

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

eq23 = FullSimplify[
   eq13 /. eq20[[1]], (lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && 
    Dp > 0 && Dc > 0 && \[Alpha]1 > 0] // Normal

eq23 should show 'true'. What's wrong?

POSTED BY: Jacques Ou
4 Replies
Posted 7 years ago

Thanks.

POSTED BY: Jacques Ou
Posted 7 years ago

Hello, Mr. Rogers, Using DSolve[eq13, q, {x, s}, GeneratedParameters -> B1] will produce a pure function and the following calculation will be based on function. But using DSolve[eq13, q[x,s], {x, s}, GeneratedParameters -> B1] will produce an expression and the following calculation will be based on substitution. Is it correct?

So if I redefine q[x,s] and it can work likewise.

In[45]:= q[x_, 
  s_] := -(E^(-((Sqrt[s] x)/Sqrt[Dp]) - 
      Sqrt[s/Dp] (lh + 
         x)) (-(E^(
            Sqrt[s/Dp] (2 lh + x)) (-Sqrt[s] + 
              Sqrt[Dp] (Sqrt[s/Dp] - \[Alpha]1)) + 
           E^(Sqrt[s/Dp] (lh + 2 x)) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) + 
           E^(lh Sqrt[s/Dp] + (2 Sqrt[s] x)/Sqrt[
             Dp]) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) + 
           E^((2 lh Sqrt[s])/Sqrt[Dp] + 
             Sqrt[s/Dp] x) (Sqrt[s] - 
              Sqrt[Dp] (Sqrt[s/Dp] + \[Alpha]1))) Sqrt[
        Dp s (s + \[Theta]c)] (-Dc s + Dp (s + \[Theta]c)) (-A2 + 
          pinf (s + \[Theta]c)) - 
       A1 Sqrt[Dp s] (s + \[Theta]c) (Dp^(
           3/2) (E^(Sqrt[s/Dp] (2 lh + x)) - 
             E^((2 lh Sqrt[s])/Sqrt[Dp] + Sqrt[s/Dp] x)) Sqrt[s/
           Dp] (s + \[Theta]c) + 
          Dc (E^(lh Sqrt[s/Dp] + (2 Sqrt[s] x)/Sqrt[
               Dp] + (lh - x) Sqrt[(s + \[Theta]c)/Dc]) (Sqrt[s] + 
                Sqrt[Dp] \[Alpha]1) (-s + 
                Dp Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc]) - 
             E^(lh Sqrt[s/Dp] + 
               2 Sqrt[s/Dp] x + (lh - x) Sqrt[(s + \[Theta]c)/
                Dc]) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + 
                Dp Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc]) + 

             E^((2 lh Sqrt[s])/Sqrt[Dp] + 
               Sqrt[s/Dp] x) (-s^(3/2) + 
                Sqrt[Dp] s (Sqrt[s/Dp] + \[Alpha]1) + 
                Dp Sqrt[s] Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc] - 
                Dp^(3/2) Sqrt[s/Dp] \[Alpha]1 Sqrt[(s + \[Theta]c)/
                 Dc]) + E^(
              Sqrt[s/Dp] (2 lh + x)) (s^(3/2) + 
                Sqrt[Dp] s (-Sqrt[(s/Dp)] + \[Alpha]1) + 
                Dp Sqrt[s] Sqrt[s/Dp] Sqrt[(s + \[Theta]c)/Dc] + 
                Dp^(3/2) Sqrt[s/Dp] \[Alpha]1 Sqrt[(s + \[Theta]c)/
                 Dc]))) - 
       2 Dp E^(Sqrt[s/Dp] (lh + x)) s Sqrt[s/
        Dp] (E^((2 lh Sqrt[s])/Sqrt[
           Dp]) (Sqrt[s] - Sqrt[Dp] \[Alpha]1) + 
          E^((2 Sqrt[s] x)/Sqrt[
           Dp]) (Sqrt[s] + Sqrt[Dp] \[Alpha]1)) (s + \[Theta]c)^(
        3/2) (-Dc s + Dp (s + \[Theta]c)) B2[1][s]))/(2 Dp^2 (s/Dp)^(
    3/2) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)^(
    3/2) (-Dc s + Dp (s + \[Theta]c)))

In[46]:= eq34 = 
 FullSimplify[
   eq14, (lh - x) < 0 && s > 0 && s + \[Theta]c > 0 && Dp > 0 && 
POSTED BY: Jacques Ou

Hi Ou Zhonghui,

Yes, that's correct.

I probably wouldn't define the function q[x, s] because then q[x, s] can no longer be treated as an unknown in the differential equation or any associated expression one might have (e.g. energy or other derived quantities and invariants). That may not be inconvenient in your case, but I find it frequently is. Otherwise, there's nothing wrong with defining q. I much more often prefer the solution in the form of the pure function substitution rule, which rules are naturally supported in WL. I've gotten used to expr /. sol, and expression rewriting is the basic operation in Mathematica.

POSTED BY: Michael Rogers

Solve the DE for q, not for q[x,s]:

DSolve[eq13, q, {x, s}, GeneratedParameters -> B1]

The solution will yield a function so that the q in the derivative Derivative[2, 0][q][x, s] in eq13 will be replaced with the function. Then all works well.

Your original form results in a solution q[x, s] -> ..., which replaces only q[x, s] literally and does not replace its derivatives.

POSTED BY: Michael Rogers
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