Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
317 views
ubuntu2004
Kernel: SageMath 9.2
# Contributions from Stephanie Perez, Jessica Phung, and Imani Chatman
#1a f(x)=2.5*x*(1-x) #This line gives the function with r=2.5. count=srange(0,20) #This line gives the range of numbers and thus the amount of iterations we want. initial=[0.9] #This gives the initial value of 0.9 we chose. for i in count: #This creates the for loop. new=f(initial[i]) #This changes every new output using the previous output as an input. (whatever 'initial' currently is, it will be input into the function f(x) and the [i] indicates that it will be the 1st, 2nd, 3rd, etc. iteration of that). The output will be called 'new'. initial.append(new) #This adds the new values to the list, making whatever 'new' is, the new current value of 'initial'. print(initial) #This prints the list. list_plot(initial, plotjoined=True, axes_labels=("time", "f(x)")) # this plots the lis #This shows equilibrium behavior after time 5.
[0.900000000000000, 0.225000000000000, 0.435937500000000, 0.614739990234375, 0.592086836602539, 0.603800036311343, 0.598063881154410, 0.600958688032335, 0.599518358276974, 0.600240240914639, 0.599879735253438, 0.600060096214258, 0.599969942863984, 0.600015026309430, 0.599992486280810, 0.600003756718455, 0.599998121605490, 0.600000939188434, 0.599999530403578, 0.600000234797660, 0.599999882601032]
Image in a Jupyter notebook
#1b f(x)=3.1*x*(1-x) #Provides the function with r=3.1 count2=srange(0,20) #This line states the amount of iterations by setting a range initial2=[0.9] #States the initial condition for i in count:# Establishes the for loop new2=f(initial2[i])# Using old output as the new input initial2.append(new2) #Places all the values into a list print(initial2)# Prints the list list_plot(initial2, plotjoined=True, axes_labels=["time", "f(x)"]) #This time series demonstrates unstable oscillatory behavior.
[0.900000000000000, 0.279000000000000, 0.623592900000000, 0.727646864715729, 0.614348405453806, 0.734465770727533, 0.604579987307145, 0.741095381389996, 0.594806352924479, 0.747136441879994, 0.585663095194179, 0.752251685777434, 0.577744169769572, 0.756263116607204, 0.571420566706964, 0.759187218218894, 0.566748156327050, 0.761188519243513, 0.563519727987681, 0.762492256884750, 0.561403226734206]
Image in a Jupyter notebook
#1c f(x)=3.5*x*(1-x) # given function with r=3.5 count3=srange(0,20) # establishes the amount of iterations that we want initial3=[0.9] # creates a list called initial3 where the initial condition is 0.9 for i in count3: # for every integer in the 'count3' list... new3=f(initial3[i]) # we will run initial3 condition=0.9 through the f(x) function and call the result 'new3' initial3.append(new3) # every 'new3' result will be appended to the 'initial3' list and become the new initial condition value print(initial3) # prints out the list list_plot(initial3, plotjoined=True, axes_labels=["time", "f(x)"]) # plots everything on 'initial3' # We are observing chaotic behavior in this time series.
[0.900000000000000, 0.315000000000000, 0.755212500000000, 0.647033029453125, 0.799334508874427, 0.561395981289169, 0.861806867185390, 0.416835268001227, 0.850792695730503, 0.444305696177444, 0.864143505826023, 0.410898275076567, 0.847213089154841, 0.453050747518434, 0.867285186919977, 0.402855570142050, 0.841970359116509, 0.465696957200042, 0.870881554391325, 0.393564054142962, 0.835349863003312]
Image in a Jupyter notebook
#1d f(x)=3.9*x*(1-x) # given function with r=3.9 count4=srange(0,20) # establishes the amount of iterations that we want initial4=[0.9] # creates a list called initial4 where the initial condition is 0.9 for i in count4: # for 20 iterations, we will... new4=f(initial4[i]) # we will run whatever the current 'initial4' is through the f(x) function and call the result 'new4' initial4.append(new4) # every 'new4' result will be appended to the 'initial4' list and become the new initial condition print(initial4) # prints out the list list_plot(initial4, plotjoined=True, axes_labels=["time", "f(x)"]) # plots everything on 'initial4' # We are observing more apparent chaotic behavior in this time series.
[0.900000000000000, 0.351000000000000, 0.888416100000000, 0.386618439717082, 0.924864024972463, 0.271013185108375, 0.770503650562575, 0.689628322626049, 0.834760287106321, 0.537948645688326, 0.969383611132645, 0.115748199840302, 0.399167160888723, 0.935347680371361, 0.235842349061573, 0.702860868257699, 0.814505125705957, 0.589237451028252, 0.943943041602523, 0.206366845669532, 0.638740325643965]
Image in a Jupyter notebook
#2 var("r") #Declares "r" as a symbolic symbol r_values=[2.5, 3.1, 3.5, 3.9] #Creates a list for "r" values so we can run them all at the same time count= srange(0,20) #Gives a range for the amount of interations for r in r_values:# Establishes a for loop where the actions listed below will be done for every r value in the list above newg=r*(1-x)*(x) # States the function init=[0.9] #Makes the list "init" with an initial condition of 0.9 for x for i in count: #Creates a for loop where for 20 iterations... newg2=newg(init[i]) #Places all new values into a list... we will plug whatever current value 'init' is into the function 'newg' 20x init.append(newg2) #Append all new values in order to create a list, becomes new 'init' show(list_plot(init, plotjoined=True, axes_labels=("time", "different r values"))) # indent one time only or else it will fall under both for loops and run 80x # Here, we observe equilibrium, unstable (increasing) oscillations, chaos, and chaos, as before.
Image in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebookImage in a Jupyter notebook
#3 h(x)=3.9*x*(1-x) # discrete logistic function w/ r=3.9 and ic=0.4 count=srange(0,20) # we want to run it 20x newinitial=[0.4] # initial condition so that new current conditions can be added for i in count: # for 20 iterations, we will... n=h(newinitial[i]) #...plug whatever 'newinitial' currently is into h(x) and call it 'n' newinitial.append(n) # append 'n' to the 'newinitial' list and it becomes the new current condition print(newinitial) # prints 'newinitial' list # Basically the same exact function, except with a different ics and we're making it green on the time series so we can differentiate g(x)=3.9*x*(1-x) # discrete logistic function w/ r=3.9 and ic=0.401 count=srange(0,20) newinitial1=[0.401] for i in count: n=g(newinitial1[i]) newinitial1.append(n) print(newinitial1) list_plot(newinitial, plotjoined=True, axes_labels=("time", "h(x)+g(x)"), legend_label=("h(x)"))+list_plot(newinitial1, plotjoined=True, color="green", legend_label=("g(x)")) # plots both of them together overlaying # The relationship between the time series starts off similarly to each other and following the same pattern, but over time becomes chaotic and has different bifurcations. This is an example of the butterfly effect.
[0.400000000000000, 0.936000000000000, 0.233625600000000, 0.698274248196096, 0.821680557758864, 0.571434313163790, 0.955098841720988, 0.167251672630438, 0.543186347467759, 0.967726263630336, 0.121805355010580, 0.417178360955174, 0.948248246813121, 0.191386685992957, 0.603555507428601, 0.933177401836699, 0.243193620298226, 0.717796885043427, 0.790001615774983, 0.647006345106807, 0.890717624543520] [0.401000000000000, 0.936776100000000, 0.230983890028281, 0.692758297045167, 0.830092531788964, 0.550051789782892, 0.965229791524164, 0.130888840205693, 0.443652111689677, 0.962617170383573, 0.140342879298556, 0.470522346562113, 0.971611164996404, 0.107573345297866, 0.374405150649239, 0.913481141884582, 0.308230046692706, 0.831574711533221, 0.546227021619479, 0.966665943641550, 0.125669298476054]
Image in a Jupyter notebook
#4a a(x)=3.7*x*(1-x) # discrete logistic function w/ r=3.7 and ic=0.7 count=srange(0,20) newinit1=[0.7] for i in count: # for 20 iterations... egg=a(newinit1[i]) # whatever 'newinit1' currently is will be plugged into a(x) and be called 'egg' newinit1.append(egg) # whatever 'egg' is will be appended to 'newinit1' and become the new current value3 print(newinit1) b(x)=3.7*x*(1-x) # discrete logistic function w/ r=3.7 and ic=0.701 count=srange(0,20) newinit2=[0.701] for i in count: nice=b(newinit2[i]) newinit2.append(nice) print(newinit2) list_plot(newinit1, plotjoined=True, axes_labels=("time", "a(x)+b(x)"), legend_label=("a(x)"))+ list_plot(newinit2, plotjoined=True, color="green", legend_label=("b(x)")) # plots both of them together overlaying
[0.700000000000000, 0.777000000000000, 0.641102700000000, 0.851333103795027, 0.468290685657684, 0.921279721720579, 0.268336565448017, 0.726428596438842, 0.735301335644523, 0.720143141342444, 0.745686890083559, 0.701660422551956, 0.774532373711816, 0.646138310401377, 0.845981298662214, 0.482098681611228, 0.923814308359792, 0.260411298509191, 0.712609840236408, 0.757749106588202, 0.679191972796040] [0.701000000000000, 0.775516300000000, 0.644135843206947, 0.848131977201183, 0.476575267864981, 0.922969743120290, 0.263057406697597, 0.717275367672789, 0.750328234029821, 0.693142368415791, 0.786975294434134, 0.620287167422435, 0.871464690207903, 0.414451740536364, 0.897921532620147, 0.339136279345763, 0.829254594495920, 0.523888224412312, 0.922888605117380, 0.263311342348943, 0.717720373555561]
Image in a Jupyter notebook
#4b e(x)=3.8*x*(1-x) # discrete logistic function w/ r=3.8 and ic=0.8 count=srange(0,20) einitial=[0.8] for i in count: newe=e(einitial[i]) einitial.append(newe) print(einitial) k(x)=3.8*x*(1-x) # discrete logistic funciton w/ r=3.8 and ic=0.801 count=srange(0,20) kinitial=[0.801] for i in count: newk=k(kinitial[i]) kinitial.append(newk) print(kinitial) list_plot(einitial, plotjoined=True, axes_labels=("time", "e(x)+k(x)"), legend_label=("e(x)"))+list_plot(kinitial, plotjoined=True, color="green", legend_label=("k(x)"))
[0.800000000000000, 0.608000000000000, 0.905676800000000, 0.324620068978688, 0.833119143220847, 0.528320218395273, 0.946952267874167, 0.190887946920127, 0.586909006834833, 0.921297933217735, 0.275530595572566, 0.758531248608774, 0.696014055272596, 0.803998262515249, 0.598823214273297, 0.912889094818637, 0.302185862443417, 0.801304354534431, 0.605019606566641, 0.908089352499034, 0.317159705432291] [0.801000000000000, 0.605716200000000, 0.907531523218728, 0.318888618815488, 0.825354936900667, 0.547747827130581, 0.941336551016371, 0.209843785200501, 0.630075609850263, 0.885705275743912, 0.384679473000589, 0.899464468999796, 0.343626924425501, 0.857080352694413, 0.465475762534607, 0.945470692704246, 0.195912275378077, 0.598616491790194, 0.913044192678580, 0.301699080599101, 0.800571632386082]
Image in a Jupyter notebook
#4c c(x)=3.9*x*(1-x) # discrete logistic function w/ r=3.9 and ic=0.9 count=srange(0,20) c_initial=[0.9] for i in count: n=c(c_initial[i]) c_initial.append(n) print(c_initial) d(x)=3.9*x*(1-x) # discrete logistic function w/ r=3.9 and ic=0.901 count=srange(0,20) d_initial=[0.901] for i in count: n=d(d_initial[i]) d_initial.append(n) print(d_initial) list_plot(c_initial, plotjoined=True, axes_labels=("time", "c(x)+d(x)"), legend_label=("c(x)"))+list_plot(d_initial, plotjoined=True, color="green", legend_label=("d(x)")) # plots both of them together overlaying # Overall, the relationship between the pairs of time series shows that a slight change in the initial condition causes bifurcations in the long term states despite similar initial transient states.
[0.900000000000000, 0.351000000000000, 0.888416100000000, 0.386618439717082, 0.924864024972463, 0.271013185108375, 0.770503650562575, 0.689628322626049, 0.834760287106321, 0.537948645688326, 0.969383611132645, 0.115748199840302, 0.399167160888723, 0.935347680371361, 0.235842349061573, 0.702860868257699, 0.814505125705957, 0.589237451028252, 0.943943041602523, 0.206366845669532, 0.638740325643965] [0.901000000000000, 0.347876100000000, 0.884747444290281, 0.397680676037179, 0.934169948180786, 0.239836178777105, 0.711027665894136, 0.801322564486365, 0.620898377312307, 0.917995971216679, 0.293589535381838, 0.808839408374846, 0.603011057355234, 0.933616016043971, 0.241710887457602, 0.714818263934036, 0.795027142573431, 0.635540042065330, 0.903352698288021, 0.340495743056712, 0.875777728866182]
Image in a Jupyter notebook
#5 count=srange(0,8) # establishes count for first 8 pairs rvalue=[] # empty list for the values of the difference in r-values from iteration to iteration for i in count: rvalue.append(abs((newinitial[i])-(newinitial1[i]))) # calculates the difference between each functions from each other (which is g(x)-h(x) from Exercise 3), gives difference in absolute value for each iteration and appends that value to the 'rvalue' list print(rvalue) list_plot(rvalue, plotjoined=True, axes_labels=("time", "difference in r values"))
[0.00100000000000000, 0.000776100000000168, 0.00264170997171956, 0.00551595115092951, 0.00841197403010030, 0.0213825233808989, 0.0101309498031757, 0.0363628324247447]
Image in a Jupyter notebook
#6 p=list_plot(list(zip(newinitial[:-1], newinitial[1:])), axes_labels=("h(x_N)", "h(x_N+1)")) # we are using data from Exercise 3, where the ic=0.4, where the values were placed in a list called 'newinitial'. # 'newinitial[:-1]' means all elements up until the last one, which is h(x_N), and 'newinitial[1:]' means the first element up until the last one, which is h(x_N+1). We plot h(x_N) and h(x_N+1) against each other in order to make the Poincare plot, and label the axes accordingly. We will name all of this p. show(p) # plots 'p'
Image in a Jupyter notebook
#7 func=3.9*x*(1-x) # the function we were told to plot q=plot(func, (x, 0,1)) # make sure plot it for 0<=x<=1 and name it 'q' show(p+q) # plots p and q together on the same space #The function lines up exactly with the points in the previous exercise. This makes sense because both exercises use the same r value, but #7 is a continuous function (line) and #6 is a discrete time function (points).
Image in a Jupyter notebook
#8a r11=3.5 # our r-value will be 3.5 r(x)=r11*x*(1-x) # logistic equation with r-value xvals1=[0.9] # our chosen initial condition for i in srange(0,250,1): # we want to iterate this 250 times by a timestep of 1. for every iteration... xnew=r(xvals1[-1]) #... we will plug in the current 'xvals1' into r(x) and call it 'xnew' xvals1.append(xnew) # we will then append whatever 'xnew' is to the 'xvals' list and have it be the new current value show(xvals1) # shows the list
[0.900000000000000,0.315000000000000,0.755212500000000,0.647033029453125,0.799334508874427,0.561395981289169,0.861806867185390,0.416835268001227,0.850792695730503,0.444305696177444,0.864143505826023,0.410898275076567,0.847213089154841,0.453050747518434,0.867285186919977,0.402855570142050,0.841970359116509,0.465696957200042,0.870881554391325,0.393564054142962,0.835349863003312,0.481391642842810,0.873788051653687,0.385988723543293,0.829505000942493,0.494992590238607,0.874912240466185,0.383042841820188,0.827123581026759,0.500465569576804,0.874999241357392,0.382814491434831,0.826936448038130,0.500893956304739,0.874997202947438,0.382819842235592,0.826940837192080,0.500883911416497,0.874997265452127,0.382819678161994,0.826940702608795,0.500884219421837,0.874997263546049,0.382819683165412,0.826940706712910,0.500884210029221,0.874997263604185,0.382819683012807,0.826940706587734,0.500884210315697,0.874997263602412,0.382819683017462,0.826940706591551,0.500884210306960,0.874997263602466,0.382819683017320,0.826940706591435,0.500884210307225,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464,0.382819683017324,0.826940706591439,0.500884210307218,0.874997263602464]\renewcommand{\Bold}[1]{\mathbf{#1}}\left[0.900000000000000, 0.315000000000000, 0.755212500000000, 0.647033029453125, 0.799334508874427, 0.561395981289169, 0.861806867185390, 0.416835268001227, 0.850792695730503, 0.444305696177444, 0.864143505826023, 0.410898275076567, 0.847213089154841, 0.453050747518434, 0.867285186919977, 0.402855570142050, 0.841970359116509, 0.465696957200042, 0.870881554391325, 0.393564054142962, 0.835349863003312, 0.481391642842810, 0.873788051653687, 0.385988723543293, 0.829505000942493, 0.494992590238607, 0.874912240466185, 0.383042841820188, 0.827123581026759, 0.500465569576804, 0.874999241357392, 0.382814491434831, 0.826936448038130, 0.500893956304739, 0.874997202947438, 0.382819842235592, 0.826940837192080, 0.500883911416497, 0.874997265452127, 0.382819678161994, 0.826940702608795, 0.500884219421837, 0.874997263546049, 0.382819683165412, 0.826940706712910, 0.500884210029221, 0.874997263604185, 0.382819683012807, 0.826940706587734, 0.500884210315697, 0.874997263602412, 0.382819683017462, 0.826940706591551, 0.500884210306960, 0.874997263602466, 0.382819683017320, 0.826940706591435, 0.500884210307225, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464\right]
#8b xvaluesnew=xvals1[100:] #takes the 'xvalues' list from the previous part of the question and indexes them to only count for iterations 100-250. we rename this new list 'xvaluesnew' xvaluesnew # shows the list (we don't have to put show() since it's just numbers either way)
[0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464, 0.382819683017324, 0.826940706591439, 0.500884210307218, 0.874997263602464]
#8c formlistrx=150*[3.5] # makes a list of just 3.5 iterated 150x (because out of 200, we threw away the first 100) coord=list(zip(formlistrx, xvaluesnew)) # this zips together the values of r and our function X (in this case, r(x)) as points. we name it 'coord' coord # shows us the points we've zipped together as a list #There are 150 different values of X.
[(3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218), (3.50000000000000, 0.874997263602464), (3.50000000000000, 0.382819683017324), (3.50000000000000, 0.826940706591439), (3.50000000000000, 0.500884210307218)]
#9 We threw away the first 100 values in the previous exercise because we are interested in observing the long-term behavior. This way, we are able to observe the behavior past the transient states.
#10 masterlist=[] r10=srange(2.0, 4.0, 0.01) # our r-values will range from 2 to 4 by time steps of 0.01 (aka, 200 iterations) for r in r10: # for every iteration of r... func1(x)=r*x*(1-x) # logistic function xval=[0.9] # initial condition in a list called 'xval' for o in srange(0,250,1): # for every iteration (in this case, 250x)... new1=func1(xval[-1]) #... whatever the current 'xval' is will be plugged into func1(x) and be called 'new1' xval.append(new1) # watever 'new1' is will be plugged into the 'xval' list and become the new current value coord1=list(zip(150*[r], xval[100:])) # put them together, and our x coordinates will be 150 iterations of r-values ranging from 2.0-4.0. masterlist=masterlist+coord1 list_plot(masterlist, axes_labels=["r", "Xn"], size=1)
Image in a Jupyter notebook
#11 # The approximate value that produces chaotic behavior are about r=3.6
#12 # As r increases, the behavior of the discrete logistic model goes through a Hopf bifurcation at about r=3.0, then a period doubling bifurcation at about r=3.45, then chaotic behavior at about r=3.6. # This plot aligns with the results from Exercise 1 because it reflects the changing nature of the oscillations. At r=3, there is 2-point oscillatory behavior, at r=3.5, there's 4-point oscillatory behavior, and as said before, around 3.6, the behavior becomes chaotic.
diff(0.15*y - 0.6*z*x - 0.01*z*x, x)
-0.610000000000000*z