Mathematica Solving a Mathematica Function of 2 Variables w/ Nestlist

  • Thread starter Thread starter peter.a
  • Start date Start date
  • Tags Tags
    Mathematica
AI Thread Summary
The discussion focuses on generating a table of values from a function of two variables in Mathematica, specifically using NestList. The user aims to modify the function's input from -2 to 0 in increments of 0.01 and store the results for plotting. A suggestion is made to use the ListPlot function to visualize the relationship between the generated x and y values. The importance of mastering Tables in Mathematica for effective data manipulation is emphasized. Overall, the conversation highlights the process of iterating through function values and plotting the results.
peter.a
Messages
19
Reaction score
0
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 can't figure out how to repeat this process.
 
Physics news on Phys.org
data = Table[Take[NestList[f, 0, 10], -2], {i, -2, 0, 0.01}]
 
Thts amazing! I am 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
 
Whoops hit post 2 times!
 
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.
 

Similar threads

Replies
1
Views
2K
Replies
1
Views
2K
Replies
19
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
2
Views
3K
Replies
2
Views
2K
Replies
4
Views
3K
Back
Top