2
$\begingroup$

I have a problem with ParametricNDSolve:

a = 1; d = 0.13; s = 0.4; f = .1;

eq = c'[t] + I a (Abs[c[t]])^2 c[t] + d (Abs[c[t]])^2 c[t] -s (Abs[c[t]])^2 c[t] - f Exp[-I w t] == 0;

r =  ParametricNDSolve[{eq, c[0] == 0}, c[t], {t, 0, 25}, {w}];
Plot[Evaluate[{Re@#, Im@#} &[c[t] /. r, {w, 1, 10, .1}]], {t, 0, 25}]

i have no idea what is wrong here; i checked the documentation center and some posts on similar topic - and i'm still stuck. Any help appreciated! Thanks in advance!

$\endgroup$
1
$\begingroup$
a = 1; d = 0.13; s = 0.4; f = .1;
eq = c'[t] + I a (Abs[c[t]])^2 c[t] + d (Abs[c[t]])^2 c[t] - 
    s (Abs[c[t]])^2 c[t] - f Exp[-I w t] == 0;
r = ParametricNDSolve[{eq, c[0] == 0}, c, {t, 0, 25}, {w}];
Plot[Table[Through@{Re, Im}@c[w][t] /. r, {w, 1, 10, .1}], {t, 0, 25}, Evaluated -> True]

enter image description here

Update: various views

pre0 = Plot[Table[Re@c[w][t] /. r, {w, 1, 10, .1}], {t, 0, 25}, 
   Evaluated -> True, ImageSize -> 500,  
   PlotLabel -> Style["Plot@Table[Re@c[w][t]/.r,{w,1,10,.1}],{t,0,25}]", 16]];
pim0 = Plot[Table[Im@c[w][t] /. r, {w, 1, 10, .1}], {t, 0, 25}, 
   Evaluated -> True, ImageSize -> 500, 
   PlotLabel -> Style["Plot@Table[Im@c[w][t]/.r,{w,1,10,.1}],{t,0,25}]", 16]];
pre1 = Plot[Table[Re@c[w][t] /. r, {t, 0, 25, 5}], {w, 1, 10}, 
   Evaluated -> True, ImageSize -> 500, 
   PlotLabel -> Style["Plot[Re@c[w][t]/.r,{t,0,25,5}],{w,1,10}]", 16]];
pim1 = Plot[Table[Im@c[w][t] /. r, {t, 0, 25, 5}], {w, 1, 10}, 
   Evaluated -> True, ImageSize -> 500, 
   PlotLabel -> Style["Plot[Table[Im@c[w][t]/.r,{t,0,25,5}],{w,1,10}]", 16]];

Row[{pre0, pim0}, Spacer[5]]

enter image description here

Row[{pre1, pim1}, Spacer[5]]

enter image description here

Plot3D[Re@c[w][t] /. r, {t, 0, 10}, {w, 1, 5}, Evaluated -> True,
  PlotPoints -> 100, BoxRatios -> 1, ImageSize -> 500,
  ColorFunction -> "TemperatureMap", Mesh -> None, Lighting -> "Neutral"]

enter image description here

$\endgroup$
2
  • $\begingroup$ thank you guys! and btw. is there a way to plot the c dependence of w without transforming the equation explicitly? $\endgroup$
    – Bar Lac
    Nov 6 '14 at 20:35
  • $\begingroup$ @BarLac, do the plots in my updated post answer your question re "the c dependence of w without transforming the equation explicitly"? $\endgroup$
    – kglr
    Nov 11 '14 at 19:20
0
$\begingroup$
r = ParametricNDSolve[{eq, c[0] == 0}, c, {t, 0, 25}, w];

Plot[Flatten[{Re@#, Im@#} &[Table[c[w][t] /. r, {w, 1, 4}]]], {t, 0, 
  25}, Evaluated -> True]
$\endgroup$
1
  • $\begingroup$ ok, thanks; also i'd like to make a fourier transform for this equation, but somehow FourierTransform[eq, t, [Omega]] is stuck on evaluation (putting a or w instead of omega doesn't work) $\endgroup$
    – Bar Lac
    Nov 11 '14 at 15:57

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.