ParametricNDSolve

want to solve this equation and get 2 dimensional plot with N2 on X-axis and theta(1) on the Y-axis with x from 0 to 1 and N2 varies from 0 to 5 theta''[x] + theta'[x] - (N2)^2*theta[x] +theta[x]^3 == 0, theta' == 1, theta == 0 please help

• What have you tried so far? Generally, you get better (and more) answers if you show your attempts. Even if they're not working, this shows where exactly you're stuck. – Lukas Lang Jan 8 at 17:37
• I am new in Mathematica and try to learn it – zia ud din Jan 8 at 19:57

\$Version

(* "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" *)

Clear["Global*"]


The differential equation can be solved analytically with DSolve

eqns = {theta''[x] + theta'[x] - Exp[-x]*N2^2*theta[x] == 0,
theta' == -1/4, theta == 1};

sol = DSolve[eqns, theta, x][];


Verifying that sol satisfies eqns

And @@ (eqns /. sol // FullSimplify)

(* True *)

theta[x_, N2_] = (theta /. sol)[x] // FullSimplify

(* (Sqrt[E^-x]
BesselK[1,
2 Sqrt[E^-x] N2] (4 Hypergeometric0F1Regularized[1, N2^2/E] -
E Hypergeometric0F1Regularized[2, N2^2]) +
E^-x (4 N2 BesselK[0, (2 N2)/Sqrt[E]] +
E BesselK[1, 2 N2]) Hypergeometric0F1Regularized[2,
E^-x N2^2])/(4 (BesselI[1, 2 N2] BesselK[0, (2 N2)/Sqrt[E]] +
BesselK[1, 2 N2] Hypergeometric0F1Regularized[1, N2^2/E])) *)

Plot[theta[1, N2], {N2, 0, 5},
Frame -> True,
FrameLabel -> (Style[#, 14, Bold] & /@ {"N2", "theta"})] NMinimize[{theta[1, N2], N2 > 0}, N2]

(* {-0.0588834, {N2 -> 5.74844}} *)

Limit[theta[1, N2], N2 -> Infinity]

(* 0 *)

Plot[theta[1, N2], {N2, 0, 25},
Frame -> True,
PlotRange -> All,
FrameLabel -> (Style[#, 14, Bold] & /@ {"N2", "theta"})]
` • thanks Bob Hanlon, now if i expend my problem then what to do? 'eqns = {theta''[x] + theta'[x] - Exp[-x]*N2^2*theta[x] +theta[x]^3== 0, theta' == -1/4, theta == 1}' – zia ud din Jan 8 at 20:34
• Comments are not the appropriate place to ask different questions. – Bob Hanlon Jan 8 at 21:00