Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
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. –  Szabolcs Jun 20 at 3:02
    
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.) –  Michael E2 Jun 20 at 3:54
    
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". –  Alexei Boulbitch Jun 20 at 7:46
    
@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.. –  user16010 Jun 20 at 13:50
    
@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. –  user16010 Jun 20 at 13:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.