Lab Quiz LS30A F19 with 100% correct answers
Lab Quiz LS30A F19 1. The simulation script below simulates the model for the spring with friction, with state variables X and V. In the table below explain what each line of code does. The lines are numbered for your convenience. The explanation for the first line is given as an example. 1 t = srange(0,100,0.1) 2 var('X,V') 3 sol= desolve_odeint([V,-X - 0.1*V],ics=[100,20],dvars=[X,V],times=t) 4 list_plot(zip(t,sol), color='red', plotjoined = True) Line Your Explanation 1 creates a list called t that goes from 0 to 99.9 by steps of 0.1 2 3 4 2. Which option shows the contents of the list mylist after the code below is run: mylist=[0,0.1,3] a=1 b=a+2 a=mylist[2] d(b) mylist[0]=a a) [0,0.1,3,5] b) [0,0.1,3,3] c) [1,3,3] d) [1,0.1,3,3] e) [3,0.1,3,3] Your answer: ______ 1 3. Which of the following options is correct about the piece of code that follows times = srange(0,3,.5) values = [] for t in times: y=t*2 d(y) a) the for loop will run a total of 3 times b) the last number appended to values will be 5 c) y is a list object d) values and times will not necessarily have the same length after executing the code e) the final size of values is indeterm
Written for
- Institution
- University Of California, Irvine School Of Law
- Course
- LIFESCIENC 30A
Document information
- Uploaded on
- January 15, 2023
- Number of pages
- 4
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
lab quiz ls30a f19