method that improves upon the Euler method
predictor corrector
To make a plot in Python, you probably want to import _____
matplotlib
What you are doing for your project?
(open-ended..)
What is the output of (pseudocode):
if 5 > 3:
print(X)
else: print(Y)
X
Difference between a for and a while loop
a for loop iterates through a known set of values, a while iterates while a condition is true
Euler method – what is missing: x(i+1) = ___ + f(x)*delta_t
x(i)
plot(x,y,’k’) plots a line with the color ____
black
Where is my office
NC 2006
If I am taller than you, and you are shorter than Sue, who is the tallest?
(me or Sue, we’ll never know)
What is b here, in general?
b = 0
for a = 1:20
b = b+a
b is the sum of the values from 1 to 20
For a better Euler solution, make the time step _____
smaller
Find the code bug:
X_vector = 1:10
Y_vector = X*2
plot(X_vector, y_vector, ‘*b’)
y_vector should be Y_vector
What are our TAs’ names (hint M and M)
Mozhgan and Monerah
What is an “if statement”
a conditional statement, does some function if the condition is true
What is printed here:
For a = 1:5:15
print(a)
1, 6, 11
How do we pick initial guesses for the bisection method?
f(xa) and f(xb) must have opposite signs
What is missing in this plot?
plot(X,Y); hold on; plot(X,Z)
title(‘My data’); xlabel(‘X values’)
a legend (since there are two lines), and y label
final exam (project) time and place
12:30, next Thursday May 12, NC 2413, project presentations
What does the following code do?
for i =1:100
if i = = 25:
break
end
end
loop through values of i from 1 to 100, but stop at 25 and exit the loop
What is printed here:
val = 10
while val > 0
print(val)
val = val – 3
10, 7, 4, 1, -2
Describe the Newton method to find a root
Start with initial guess, use derivative (tangent slope) to improve it, iterate
Define a histogram
a plot that shows a frequency distribution for a dataset
define Arduino
"an open-source electronics platform based on easy-to-use hardware and software"
What is the problem with this statement?
If Grade > 90
disp(‘you got an A’)
elseif Grade < 90
disp(‘you did not get an A’)
end
it does not account for a grade of 90
What is the final value of X?
X=0
for a = 1:5
for b = 1:3
X = X+1
X = 15, or the total number of iterations