-2
$\begingroup$
 I am trying to solve the following differential equation in Mathematica. It is giving 
the same results regardless of the domain that I give as input. 

$$ \phi''[y] + (1/y)\phi'[y] + (1 - 1/y^2)\phi[y] == 0 $$

$$DSolve[\Phi''[y] + 1/y\Phi'[y] + (1 - 1/y^2)\Phi[y] == 0, \Phi[y], \{y, 0, \infty\}]$$

This needs to be solved in the following domains 

$$ y = (0, \infty ) , (-\infty, 0) , (-\infty, \infty)$$ How do I solve it?

$\endgroup$
5
  • 2
    $\begingroup$ Please post the code you tried. $\endgroup$
    – Nasser
    Nov 4, 2021 at 4:55
  • 1
    $\begingroup$ unfortunately DSolve in 12.3.1 does not recognize this as Bessel ODE. The solution by Maple is $\phi \left(y \right) = c_{1} J_{1}\left(y \right)+c_{2} Y_{1}\left(y \right)$ and now you can investigate what happens to the solution for different ranges of $y$ by looking up the properties of BesselJ and BesselY functions. Here is slightly corrected Mathematica input code ode = phi''[y] + 1/y∗phi'[y] + (1 - 1/y^2) ∗phi[y] == 0; DSolve[ode, phi[y], y] $\endgroup$
    – Nasser
    Nov 4, 2021 at 5:25
  • 2
    $\begingroup$ ode = phi''[y] + 1/y phi'[y] + (1 - 1/y^2) phi[y] == 0; and DSolve[ode, phi[y], y] gives {{phi[y] -> BesselJ[1, y] C[1] + BesselY[1, y] C[2]}} on Mma 12.2 Win7x64. I had to remove the asterisks @Nasser. $\endgroup$
    – Syed
    Nov 4, 2021 at 5:49
  • $\begingroup$ M12.0 gives the Bessel solution also. $\endgroup$
    – Bill Watts
    Nov 4, 2021 at 5:52
  • 3
    $\begingroup$ @Syed I see. I just copied it from the post. It looks like the * shown in the post, was not an actual multiplication sign. But it looks like it on the screen in the notebook. That is why folks should post code in Plain text using InputForm. $\endgroup$
    – Nasser
    Nov 4, 2021 at 5:53

1 Answer 1

4
$\begingroup$

You can investigate analytically this much easier. BesselY is complex for negative y. So for $y<0$ there is no solution in the reals.

BesselY[1, -1] // N
(*0.781213 - 0.880101 I*)

Additionally, BesselY goes to $-\infty$ at zero, so solution blows up there.

Limit[BesselY[1,y],y->0,Direction->"FromAbove"]
(* - Infinity *)

This is why you see many books set this part of the solution to zero, to get rid of it, if the solution is meant to be finite at the origin. This is done for example when solving PDE's in cylindrical coordinates, where the solution (say temperature) is supposed to be finite at center of disk for example. When doing separation of Variables, Bessel ODE can pop up, depending on the coordinates used.

So you can set C[2]->0 below if you do not want this to be part of the solution.

For $y>0$ the solution will go to zero as $y \to \infty$

But if you need to use Mathematica

ClearAll[phi, y];
ode = phi''[y] + 1/y*phi'[y] + (1 - 1/y^2)* phi[y] == 0;
sol = phi[y] /. First@DSolve[ode, phi[y], y];
sol = sol /. {C[1] -> 1, C[2] -> 1} (*change as needed*)

Mathematica graphics

Limit[sol, y -> Infinity]
(*0*)

Limit[Abs[sol], y -> -Infinity]
(*0*)

Limit[sol, y -> 0]
(*Indeterminate*)

Here is a quick Manipulate also

Mathematica graphics

Manipulate[
 Module[{g},
  If[from > to, from = to - 1];
  g = Grid[{
     {Plot[BesselJ[1, y], {y, from, to}, AxesLabel -> {y, "BesselJ"}, 
       ImageSize -> 150], 
      Plot[BesselY[1, y], {y, from, to}, AxesLabel -> {y, "BesselY"}, 
       ImageSize -> 150]},
     {Plot[sol, {y, from, to}, AxesLabel -> {y, phi[y]}, 
       ImageSize -> 300], SpanFromLeft}
     }, Frame -> All, Spacings -> {1, 1}
    ];
  
  If[from < 0,
   g = Grid[{
      {"Warning, BesselY[1,y] is complex valued for negative Y!"},
      {g}
      }, Frame -> All, Spacings -> {1, 1}
     ]
   ];
  g
  ],
 {{from, 0, "from"}, -10000, 10000, 1, Appearance -> "Labeled"},
 {{to, 100, "to"}, -10000, 10000, 1, Appearance -> "Labeled"},
 TrackedSymbols :> {from, to}
 ]
$\endgroup$
1
  • 3
    $\begingroup$ you need to slow down you rate of good answers otherwise you will not reach 1 000 000 points in 10 years exactly :-) $\endgroup$
    – chris
    Nov 4, 2021 at 7:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.