2

I have the following code in Mathematica that gives me the plot I want but how do I display the solution vector or numerical solution in terms of the x vlaues and the corresponding y values in Mathematica? Thank you

lambda = ((8*0.15)/10);
m = (332/0.59) ;
a = 2;
b = 100;
Eqn = y''[x] + 2*y'[x]/x -(lambda^2)*Cosh[y[x]] == 0; 
sol = NDSolveValue[ {Eqn, y'[a] == -m/(10*a^2), y[b] == 0}, y[x], {x, a, b}]
Plot[Evaluate[sol], {x, a, b}]
  • Well, Ithink it does but I am not sure why i get negative values since the plot is exponentially decaying. I added Table[sol,{x,50}] after the plot line but the first value is negative which isn't right. I am not sure what I am doing wrong. – user3307971 Mar 02 '22 at 20:32
  • Hi Michael, it worked. The ouput had a statement that said the first value was extrapolated so I understand why it's negative. Thanks for the help. – user3307971 Mar 02 '22 at 20:42
  • What's your Mathematica version? On v12.2 your code sol=...doesn't evaluate – Ulrich Neumann Mar 02 '22 at 21:24
  • Thanks Ulrich but I was using the online version. – user3307971 Mar 04 '22 at 18:13

0 Answers0