Hi I am trying to practice the following question for my test tomorrow. Please help me find my errors.
*Consider the following displacement sequence [x1; x2;..... x11] and velocity sequence [v1; v2;....... v11]:x[k+1] = x[k]+ 0.1 v[k]v[k+1] = v[k] - 10* x[k] + 0.1 sin(0.1* k *theta)Compute the maximum displacement from the displacementsequence. Use theta = 1 [rad] and theinitial values x1 = 0 and v1 = 0.* Here is my code: x = np.zeros(11) v = np.zeros(11) x[0] = 1 v[0] = 1 a = np.arange(1,10,1) for k in a: x[k+1] = x[k] + 0.1*v[k] v[k+1] = v[k] - 10*x[k] +0.1*sin(0.1*k*1) print(x.max()) *This was a follow-up question with a suggested answer:Repeat the maximum displacement computation for theta = 1; 2,3.... 20 [rad] and store the maximum displacement for each in a list.from math import sinmax_disp = []omega_values = range(1, 21, 1)for omega in omega_values: x = [0.0] * 11 v = [0.0] * 11 for k in range(10): x[k+1] = x[k] + 0.1 * v[k] v[k+1] = v[k] - 10 * x[k] + 0.1 * sin(0.1 * omega * (k + 1)) max_disp.append( max(x) ) print(max_disp)* My question is what do the lines in red mean? Thank you for your time. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor