Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Repeat the loop for a few intervals

  1. Jul 24, 2012 #1
    I am trying to find the three roots from x=0 to x=2∏ for this equation: x*Sin[x] + 1.5 x - 3. I want to divide the graph into intervals of say from x=1.0 to x=2.0 as one interval and so on and so forth. How do I go about inserting that code into my existing codes? I am using the bisection method to solve this equation. I thought of just replacing the intervals one by one but I don't think it's very feasible. Could anyone of you guide me on how to go about doing it? I'm using Mathematica 8. Thanks!
     
  2. jcsd
  3. Jul 26, 2012 #2
    I'm not exactly sure what you need. Will this help?

    For[high = 1, high ≤ 7, high++,
    low = high - 1;
    yourbisectioncodeusinglowandhighendpoints;
    ]

    If that isn't what you need then provide some more detail.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Repeat the loop for a few intervals
Loading...