0
$\begingroup$

enter image description here Why is the error coming and what should I do to resolve it enter image description here The code is

sol1=DSolve[{2*y'[r]+r*y''[r]==-.262468*(-13.60r+14.3996)*y[r],
  y[0.0001]==1,y'[30]==0},y[r],r]


Plot[ Evaluate[y[r]/ sol1],{r,.000000001,.000001}]
$\endgroup$
7
  • $\begingroup$ Note that sol1 and sol are 2 different variables. $\endgroup$ Oct 26 '20 at 19:41
  • $\begingroup$ @DanielHuber i changed it but now this is coming $\endgroup$
    – zeeman
    Oct 26 '20 at 19:59
  • $\begingroup$ when i used Plot[ Evaluate[y[r]/. sol1],{r,.000000001,.000001}] still error was coming $\endgroup$
    – zeeman
    Oct 26 '20 at 19:59
  • 1
    $\begingroup$ Please edit your question and add the code as text, not an image, so others can copy/paste and reproduce the problem. $\endgroup$ Oct 26 '20 at 20:15
  • $\begingroup$ Use DSolveValue instead so you don't have to muck around with replacement rules. $\endgroup$ Oct 26 '20 at 20:36
2
$\begingroup$

Your code contains: ry''[r]. You need a space between r and y.

But this does not solve your problem. DSolve seems not able to solve this. Maybe there is no closed form solution.

Trying to use NDSolve indicates that the system is unstable. The reason is that y'[30] is too far out, y'[10] will work.

sol = y /. 
  NDSolve[{2 y'[r] + r  y''[r] == -.262468*(-13.60 r + 14.3996)*y[r] ,
      y[0.0001] == 1, y'[10] == 0}, y, {r, .000000001, 10}][[1]]

Plot[sol[r], {r, .000000001, .0001}]

enter image description here

$\endgroup$
1
$\begingroup$

DSolve is an exact solver, and exact solvers sometimes cannot solve equations with inexact (floating-point) coefficients because round-off error makes things that should be equal or cancel fail to do so. Use exact input and the system can be solved (after all, it's linear).

sol1 = DSolve[
    Rationalize@{
      2*y'[r] + r*y''[r] == -.262468*(-13.60 r + 14.3996)*y[r],
      y[0.0001] == 1, y'[30] == 0},
    y, r];

Plot[Evaluate[y[r] /. sol1], {r, .000000001, .0001}]

enter image description here

Generic solution, followed by specialization to OP's case:

sol2 = DSolve[
   {2*y'[r] + r*y''[r] == c*(m r + b)*y[r], y[r1] == 1, y'[r2] == 0},
   y, r];

Block[{c, m, b, r1, r2},
 c = -.262468;
 m = -13.60;
 b = 14.3996;
 r1 = 0.0001;
 r2 = 30;
 Plot[Evaluate[y[r] /. sol2], {r, .000000001, .0001}]
 ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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