Mathematica Asked by Malvika Pal on March 31, 2021
I’m trying to solve u_xx + x/2 u_x = 0, with t=0 as x goes to infinity, not sure how to impose initial conditions though? Thankyou
Clear["Global`*"]
eqn = {u''[x] + x/2 u'[x] == 0, u[0] == u0};
sol = DSolve[eqn, u, x][[1]]
(* {u -> Function[{x}, u0 + Sqrt[π] C[1] Erf[x/2]]} *)
eqn /. sol
(* {True, True} *)
u[Infinity] /. sol
u0 + Sqrt[π] C[1]
For u
to go to 0 at infinity, set the arbitrary constant to C[1] -> -u0/Sqrt[Pi]
sol2[x_, u0_] = (u /. sol /. C[1] -> -u0/Sqrt[Pi])[x] // FullSimplify
(* u0 Erfc[x/2] *)
sol2[Infinity, u0]
(* 0 *)
sol2[-Infinity, u0]
(* 2 u0 *)
Plot[Evaluate@Table[sol2[x, u0], {u0, 5, 1, -1}],
{x, -4, 5}, PlotLegends -> Range[5, 1, -1]]
Answered by Bob Hanlon on March 31, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP