Finding where a differential equation solution crosses the x-axis in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter bruce999
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
bruce999
Messages
11
Reaction score
1
I'm very new to mathematica and have been trying to use it for solving differential eqns. I've done a simple equation and managed to do a plot of it which looks correct. All day I've been trying to get findroot to work so i can find the exact point at which it crosses the x-axis but keep having problems. Attached is a screenshot of what I've done. If anyone can help i'd appreciate it.
 

Attachments

  • findroot problem.JPG
    findroot problem.JPG
    30.6 KB · Views: 605
Physics news on Phys.org
Fortunately for you and I, the problem is as simple as could be: In mathematica, rules only assign values during the instance you use them. What I mean is, everytime you want mathematica to recognize Phi(t) as the solution to your differential equation, you have to include

Phi(t)/.Simpletreb

NDSolve gives a rule as output. You named the rule simpletreb (sp?). What I mean is that your must change your code to this:

FindRoot[Phi(t)/.simpletreb,{t,.2}]
 
Thanks a lot! Very much appreciated. You can tell I'm new to this. I've been trying everything for days now. Problem solved! :smile: