Message Boards Message Boards

[✓] Use the replace rule correctly?

GROUPS:

I used the replace rule, but it didn't work. Would you like to show how to use the replace rule correctly?

In[400]:= eq33 = eq32 /. {A1 -> Sqrt[Dc]*F1* \[Lambda]}

Out[400]= \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(T\)]\(
\*FractionBox[\(
\*SuperscriptBox[\(Dc\), \(3/2\)]\ 
\*SuperscriptBox[\(E\), \(\(-
\*FractionBox[
SuperscriptBox[\((lh - x)\), \(2\)], \(4\ Dc\ t\)]\) + 
\*FractionBox[\(\(-Dc\)\ t\ \[Theta]c + Dp\ T\ \[Theta]c\), \(Dc - 
        Dp\)]\)]\ F1\ \[Lambda]\), \(\((Dc - Dp)\)\ 
\*SqrtBox[\(\[Pi]\)]\ 
\*SqrtBox[\(t\)]\)] \[DifferentialD]t\)\)

eq34 = eq33 //. {(Dp*\[Theta]c)/(Dc - Dp) -> A3, (Dc*\[Theta]c)/(
    Dc - Dp) -> A5, -((lh - x)^2/(4 Dp t)) -> -(A10^2/t), (
    Dc^(3/2)  F1 \[Lambda])/((Dc - Dp) Sqrt[\[Pi]] ) -> A11}

Out[409]= \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(T\)]\(
\*FractionBox[\(A11\ 
\*SuperscriptBox[\(E\), \(\(-
\*FractionBox[
SuperscriptBox[\((lh - x)\), \(2\)], \(4\ Dc\ t\)]\) + 
\*FractionBox[\(\(-Dc\)\ t\ \[Theta]c + Dp\ T\ \[Theta]c\), \(Dc - 
        Dp\)]\)]\), 
SqrtBox[\(t\)]] \[DifferentialD]t\)\)

enter image description here

POSTED BY: Zhonghui Ou
Answer
2 months ago

Start with

eq1 = (Dc^(3/2) E^(-((lh-x)^2/(4 Dc t))-(-Dc t θc+Dp T θc)/(Dc-Dp)) F1 λ)/(Dc-Dp Sqrt[π] Sqrt[t])

Try your substitutions

eq1/.{((Dp θc)/(Dc-Dp))->A3, (Dc θc)/(Dc-Dp)->A5, -(lh-x)^2/(4*Dc*t)->-A10^2/t, Dc^(3/2) F1 λ/((Dc-Dp) Sqrt[π])->A11}

Only the A10 substitution succeeds because the other substitutions are within larger expressions.

Use Apart to expose the expressions

Apart[eq1]/.{((Dp θc)/(Dc-Dp))->A3, (Dc θc)/(Dc-Dp)->A5, -(lh-x)^2/(4*Dc*t)->-A10^2/t, Dc^(3/2) F1 λ/((Dc-Dp) Sqrt[π])->A11}

Now the A3, A5 and A10 substitutions succeed. But still the A11 substitution does not succeed because it is inside a larger expression.

POSTED BY: Bill Simpson
Answer
2 months ago

I tried in this way.

eq32 = (eq31 /. {t -> (T - t)})*eq30

(A1 Dc E^(-((lh - x)^2/(4 Dc t)) - t \[Theta]c + (
  Dp (-t + T) \[Theta]c)/(Dc - Dp)))/((Dc - Dp) Sqrt[\[Pi]] Sqrt[t])

eq33 = eq32 /. {A1 -> Sqrt[Dc] F1 \[Lambda]} /. {(Dp*\[Theta]c)/(
      Dc - Dp) -> A3} /. {-((lh - x)^2/(4 Dc t)) -> -(A10^2/t)} /. {(
    Dc^(3/2)  F1 \[Lambda])/((Dc - Dp) Sqrt[\[Pi]] ) -> A11}

(A11 E^(-(A10^2/t) + A3 (-t + T) - t \[Theta]c))/Sqrt[t]

enter image description here

Thanks for your help.

Why the Mathematica codes don't display correctly?

POSTED BY: Zhonghui Ou
Answer
2 months ago

Please show what eqn30 and eqn31 are so that I can understand what you are trying to do.

Then please try

eq32 = (eq31 /. t -> (T - t))*eq30

eq33 = eq32 /. A1->Sqrt[Dc] F1 \[Lambda]

eqn34 = eqn33 /. (Dp*\[Theta]c)/(Dc-Dp)->A3

eqn35 = eqn34 /. -((lh-x)^2/(4 Dc t)) -> -(A10^2/t)

eqn36 = eqn35 /. (Dc^(3/2)  F1 \[Lambda])/((Dc-Dp) Sqrt[\[Pi]] )->A11

and paste all the results so we can see each substitution separately and try to understand where it is not working

POSTED BY: Bill Simpson
Answer
2 months ago

Group Abstract Group Abstract