I am a new user to Mathematica and I would like to solve a simple second-order differential equation as follow:
$y''[x]+\frac{(D-1)}{x}\times y'[x]=k\times y[x]$,
where $D$ and $k$ are just two parameters and the boundary conditions are $y[x=0]=A$ and $y[x=\infty]=0$.
How can I get an analytical solution for the equation with the boundary condition at infinity?
My attempt for the question looks like:
sol = DSolve[{y''[x] + (D - 1)*y'[x]/x == k*y[x], y[0] == A, y[Infinity] == 0}, y[x], x]
but the solver take the second input boundary condition as a 'True' argument.
y[Infinity] == 0
is not a valid boundary condition. Try usingDSolve[{y''[x] + (D - 1)*y'[x]/x == k*y[x]}, y[x], x]
and then applying the boundary conditions after the fact. $\endgroup$DSolve[{y''[x] + (D - 1)*y'[x]/x == k*y[x]}, y[x], x]
and I get the following result :{{y[x] -> x^((2 - D)/2) BesselJ[1/2 (-2 + D), -I Sqrt[k] x] C[1] + x^((2 - D)/2) BesselY[1/2 (-2 + D), -I Sqrt[k] x] C[2]}}
. After that how can I apply the boundary condition at infinity? $\endgroup$D
? Btw, you should not useD
but used
. I found the solution to be zero whend>2
. otherwise, not defined. $\endgroup$D
is the partial derivative operator and a protected symbol. It's best practice to avoid single-letter capitals for your own variables. $\endgroup$