INSTRUCTIONS
MATH 210 Practice Questions
December 2018
◦ Plain scientific calculators are allowed but not graphing or programmable calculators ◦ No cellphones, laptops or notes
◦ 120 minutes
Name:
Student #:
Signature:
December 2018 MATH 210 Practice Questions Page 1 of 11
1. (a) Start with the interval [−2,2] and implement the bisection method to find an interval of length 0.25 containing a solution of the equation
y = x7 + x3 − x + 2
(b) Approximate a solution of the equation above by executing 1 iteration of Newton’s method with initial point equal to the midpoint of the interval found in part (a).
December 2018
MATH 210 Practice Questions
Page 2 of 11
2. Consider the definite integral
The derivatives of f (x) =
′ 2×3
(a) Approximate the integral I using N = 3 subintervals of equal length with the trapezoid
rule and find a bound on the error.
I= 1 + x4 are
2 4 1+x dx
0
√
f(x)=√x4+1 f(x)= √3×4+1
′′ 2×2(x4 + 3)
(b) Determine the length of partition N required to approximate the integral I with error less than 0.01 for each method:
i. Left (or right) Riemann sum ii. Midpoint Riemann sum
iii. Trapezoid rule
December 2018 MATH 210 Practice Questions Page 3 of 11
3. Suppose the general solution of the system of equation x ̇ = Ax is 1 0 1
x(t)=C12e−2t +C21e4t +C31et 131
C1 Write Python code to find the coefficients C1, C2 and C3 as a 2D NumPy array C = C2 given
C3
5
the initial condition x(0) = 2. (Do not solve the system of equations, write the Python code 1
that would compute the coefficients when executed.)
December 2018 MATH 210 Practice Questions Page 4 of 11
4. Write Python code to find the coefficients of the unique quadratic polynomial interpolating (−1,2),(0,2),(1,3). (Do not solve the system of equations, write the Python code that would compute the coefficients when executed.)
December 2018 MATH 210 Practice Questions Page 5 of 11
5. Find the line y = a0 + a1x which best fits the points
(1.08, 13.63) , (3.49, 6.08) , (4.55, 2.93) , (2.24, 9.15)
December 2018 MATH 210 Practice Questions Page 6 of 11
6. Canada’s Gross Domestic Product (GDP) was $742 billion USD (US dollars) in 2000, $1169 billion USD in 2005, $1613 billion USD in 2010 and $1560 billion USD in 2015. Use linear regression to predict Canada’s GDP in 2020.
December 2018 MATH 210 Practice Questions Page 7 of 11
7. (5 points) Consider the system of differential equations
x ̈ 1 = − 2 ω 02 x 1 + ω 02 x 2
x ̈ 2 = ω 02 x 1 − 2 ω 02 x 2
The system describes a mass-spring system with two masses. The variables x1 and x2 are the positions of each mass with respect to their equilibrium position. Write Python code to plot the solutions x1(t) and x2(t) over time 0 ≤ t ≤ 2 given ω0 = 1 and initial conditions x1(0) = 1, x2(0)=−1,x ̇1 =x ̇2 =0.
def odefun(u,t):
dudt = np.zeros(4)
# Code required here
return dudt
u = spi.odeint(odefun,u0,t) # Code required here
plt.show()
December 2018 MATH 210 Practice Questions Page 8 of 11
8. Write a function called elementary which takes input parameters i, j, k and n and returns the elementary matrix E of size n which performs the operation: add k times row j to row i (using 0indexing). Forexample,ifi=1,j=3,k=−2andn=5then
100 0 0
0 1 0 −2 0 E=0 0 1 0 0 0 0 0 1 0
00001 Also, if i = 2, j = 2, k = 7 and n = 4 then
1 0 0 0 E=0 1 0 0 0 0 8 0
0001
December 2018 MATH 210 Practice Questions Page 9 of 11
9. Write a function called is symmetric which takes an input parameter A and returns True if A is a square symmetric matrix and False otherwise. For example,
returns False and
returns True.
is symmetric(np.array([[1,2,3],[4,5,6]])
is symmetric(np.array([[1,2],[2,1]])
December 2018 MATH 210 Practice Questions Page 10 of 11
10. Write a function called almost complete which takes an input parameter n and returns the adjacency matrix of the almost complete graph on n vertices. The almost complete graph is constructed as follows: label the vertices 0, …, n − 1 and then vertex i is connected to every other node except vertex i + 1. This means vertex n − 1 is not connected to vertex 0.
For example, almost complete(4) returns
0 0 1 1 0 0 0 1 1 0 0 0 1100
December 2018 MATH 210 Practice Questions Page 11 of 11
11. Consider the initial value problem
y′ =y+sin(yt)+1 , y(0)=0
(a) Implement Euler’s method to compute approximations for y(0.2) and y(0.4). (b) Write Python code to compute approximations y(t) for t = 0.1, 0.2, . . . , 2.