1
$\begingroup$

I'm looking for a way to find a specific solution to a differential equation. As a simplified version of my problem, here's a similar setup for a simple harmonic oscillator problem.

aargh = 
  NDSolve[{
   -0.000000000001 + q''[x] == -q[x], 
   q'[π] == q'[-π], q[-π] == q[π]}, 
   q, {x, -π, π}];
Plot[Evaluate[q[x] /. aargh], {x, -π, π}]

The reason for the 0.00000000001 is to perturb the system slightly to ensure that I get a nonzero solution. This gives a beautiful harmonic function as a solution. Now, what I want to do, is specify a starting trial solution for NDSolve to look around. For example, say I wanted to find the $\sin(x)$ solution to the differential equation. Is there any way by which I can specify this and ask Mathematica to look around a particular function for my solution.

My actual problem is far more complicated, but is essentially the same. It is also homogenous, so I've added a perturbation there as well to find the non zero solution. Once again, Mathematica is returning an approximately valid solution, but I know that there exists another solution somewhere else. How do I tell Mathematica to look there?

$\endgroup$
  • 1
    $\begingroup$ Does this help? The idea is to make q depend on another variable as well ("time") and construct the equation so that you get the solution of your boundary value problem at t -> Infinity. Now you have a PDE and it's possible to set an initial condition. $\endgroup$ – Szabolcs Jun 20 '14 at 3:02
  • $\begingroup$ There's a two-dimensional family of solutions to your BVP, 1.`*^-12 + C[1] Sin[x] + C[2] Cos[x]. I think the NDSolve methods for BVPs expect the solution to be unique (or perhaps a discrete set). (Execute DSolve[{-10^-12 + q''[x] == -q[x], q[π] == q[-π], q'[-π] == q'[π]}, q, x] and examine the warning messages and solution.) $\endgroup$ – Michael E2 Jun 20 '14 at 3:54
  • $\begingroup$ It seems that you might replace qby anothe variable, such as q[x]=Sin[x]+z[x]and reformulate your problem in terms of z[x]. This will explicitly mean "to look around". $\endgroup$ – Alexei Boulbitch Jun 20 '14 at 7:46
  • $\begingroup$ @Szabolcs: Hmm. Yes, that does seem similar to what i'm trying to do. I'll try that out and get back to you on the results.. $\endgroup$ – SarthakC Jun 20 '14 at 13:50
  • $\begingroup$ @MichaelE2: Yes, I understand that in this particular sample problem there is an entire family of solutions. I want to make Mathematica converge to a preferable member of that family rather than an arbitrary one. $\endgroup$ – SarthakC Jun 20 '14 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.