I would like to plot solution to a differential equation using ParametricNDSolve3D. The indepedent variable f has arguments q and t where q represents angle between 0 and 2pi while t represents time. So, I would like to plot the solution on a circle and watch it evolve in time possibly using Manipulate function. But I am not able to do it. I keep getting error while plotting for reasons that are not clear to me. i would like the plot to be on a circle because the variable q represents angle. However, I keep getting error while plotting for reasons that are not clear to me.

  • 3
    $\begingroup$ Please don't post images of the code, but the code itself so users don't have to type it. regards $\endgroup$ – Moo Apr 29 '19 at 4:07
  • $\begingroup$ I genuinely tried to post the code, however, I don't know how to integrate function of two variables over one variable only. I was able to do it in the format shown in screenshot but I can't copy it as a code snippet in the description. That's why I shared code as an image, I am unable to paste it in the description $\endgroup$ – Achint Kumar Apr 29 '19 at 5:06
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ – bbgodfrey Apr 29 '19 at 13:24

Rewrite your code slightly as

sol = Flatten@NDSolve[{D[f[q, t], t] == -f[q, t] + Max[0, a f[q, t] + 
   c D[f[q, t], q, q] - b Integrate[f[q, t], {q, 0, 2 Pi}] + 1], f[q, 0] == Cos[q] + 1,
   f[2 Pi, t] == f[0, t]}, f, {t, 0, 2}, {q, 0, 2 Pi}]
ParametricPlot3D[{f[q, 1] /. sol, Cos[q], Sin[q]}, {q, 0, 2 Pi}, ImageSize -> Large]

to add a periodic boundary condition in q and to eliminate a pair of curly brackets in sol.

enter image description here

| improve this answer | |
  • $\begingroup$ Thank you so much! It works:) $\endgroup$ – Achint Kumar Apr 29 '19 at 7:43

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.