Feb-07-2018, 10:19 PM
(This post was last modified: Feb-07-2018, 10:19 PM by midnitetots12.)
I'm trying to plot a list of the the outputs as a list with the corresponding time values, for this function with a varied number of iterations. I'm not sure why I keep getting "List Indices must be Integers" however. Was wondering if anyone could look at my code and see what's wrong and how I might fix it.
def iterate3(finaltime2,stepsize): g(x) = 10*e^(0.05*x) count = srange(0,finaltime2/stepsize) initialvalat0 = [10] for i in count: a = g(initialvalat0[i]) initialvalat0.append(a) return zip(srange(0,finaltime2/stepsize),initialvalat0) graph4 = iterate3(10,0.1) graph5 = iterate3(100,0.1) graph6 = iterate3(100,0.01) list_plot(graph4)