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

Mathematica question

  1. May 4, 2012 #1
    I have a function of two variables

    f[x_][y_]=x^2+y;

    d=Take[NestList[f[-2],0,10],-2];

    now i want to repeat this process by changing -2 to -1.99, then -1.98 all the way up to 0
    and storing values in a table, so i can later make a plot. I cant figure out how to repeat this process.
     
  2. jcsd
  3. May 4, 2012 #2

    Hepth

    User Avatar
    Gold Member

    data = Table[Take[NestList[f, 0, 10], -2], {i, -2, 0, 0.01}]
     
  4. May 4, 2012 #3
    Thts amazing! Im a bit intimidated by the fact you did in 2 seconds what i have been working on for the better part of an hour.
    Thanks.
    can you tell me how i can plot this stored data using ListPlot ? to see what the relationship is between x and the y values
     
  5. May 4, 2012 #4
    Whoops hit post 2 times!
     
  6. May 5, 2012 #5

    Hepth

    User Avatar
    Gold Member

    Is "ListPlot[data]" not what you're looking for?

    And don't be intimidated, if you start using Mathematica a lot, Tables are a MAJOR component to using it well.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica question
  1. Mathematica question (Replies: 1)

  2. Mathematica Question (Replies: 1)

  3. Mathematica questions (Replies: 10)

  4. Mathematica question (Replies: 10)

  5. Mathematica question (Replies: 1)

Loading...