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 have been trying to put Points at the intersection of two curves, one of which is the ouput of a differential equation solved with NDSolve. The output being an Interpolation, NSolve cannot find the intersection coordinates.

share|improve this question
1  
NSolve[] wouldn't be up to the task here, as it's mostly intended for algebraic equations. Why not mention the particular "curves" whose intersections you seek? Maybe the differential equation too, while you're at it... –  J. M. Nov 3 '12 at 16:46
1  
The docs do mention that "NSolve deals primarily with linear and polynomial equations." Maybe you should try with FindRoot, but that locates one root at a time as it's a fully numerical function. –  acl Nov 3 '12 at 16:49
    
Bonjour & bienvenue sur Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2)Read the FAQs! 3) When you see good Q&A, 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. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign` –  chris Nov 4 '12 at 10:23

1 Answer 1

I would use FindRoot in this case. For example:

solution1=NDSolve[{y'[x]==2y[x],y[0]==1},y[x],{x,-1,1}][[1,1,2]];
solution2=NDSolve[{y'[x]==-3y[x],y[0]==3},y[x],{x,-1,1}][[1,1,2]];
Plot[{solution1,solution2,solution1-solution2},{x,-1,1}]
FindRoot[solution1-solution2,{x,0}]

With the results:

enter image description here

share|improve this answer
    
I could not get FindRoot to work when one functionF"f" is the result of NDSolve and the other function "g"is –  Jean-Pierre Raynauld Nov 3 '12 at 21:18
    
I could not get FindRoot to work when "f" is the output of NDSolve and "g" is a simple function like y=2x! –  Jean-Pierre Raynauld Nov 3 '12 at 21:20
    
@Jean, as you've been told previously, edit your question to include the Mathematica code you already have, including the NDSolve[] bits. –  J. M. Nov 3 '12 at 23:54

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.