Solve $y'' -2*(x^4-e)y = 0$ 2nd order non-linear differential equation?

GROUPS:
 I want to solve the below differential equation: $$y'' -2*(x^4-e)y = 0$$with i.c. y(0) = 1 , y'(0) = 0the values of e can be different, and I want to plot the result for different given values of e. I would be grateful if someone could help me answer this question.
1 year ago
6 Replies
 ParametricNDSolve is the function that you are looking for. Use the second example on the page: sol = ParametricNDSolve[{y''[t] - 2*(t^4-a) y[t] == 0, y[0] == 1, y'[0] == 0},y, {t, 0, 1}, {a}] Plot[Evaluate[Table[y[a][t] /. sol, {a, -1, 1, .1}]], {t, 0, 1}, PlotRange -> All] 
1 year ago
 thank you! do you also know if i can give a vector of values to a ?
1 year ago
 sol = DSolve[{y''[t] - 2*(t^4 - e) y[t] == 0, y[0] == 1, y'[0] == 0}, y, t] sol = First@sol; With[{erange = Range[2, -2, -1]}, Plot[ Evaluate@Table[ y[t] /. sol, {e, erange}], {t, 0, 2}, PlotLegends -> (HoldForm[e = #] & /@ erange) ] ] Note the result of DSolve is a DifferentialRoot, but it can be evaluated like other expressions.
1 year ago
 This is exactly what I want except that it doesn't work with non-integer values for 'e' :( Can you help me to fix that? Id really appreciate it
1 year ago
 You can use Rationalize[.., 0] or SetPrecision[.., Infinity] to convert approximate numbers to the exact numbers required by DifferentialRoot[]. (There is a slight difference between the two functions, on the order of 10^-16 or less, but it makes no difference in plotting these solutions.) SeedRandom[2]; With[{erange = Sort[RandomReal[{-3, 3}, 6]]}, Plot[ Evaluate@Table[ y[t] /. sol, {e, Rationalize[erange, 0]}], {t, 0, 2}, PlotLegends -> (HoldForm[e = #] & /@ erange ) ] ] 
1 year ago
 Thank you so much this was exactly what i needed!