## Description

- (a) Develop an algorithm which, for a given function of two variables
*f*(*x,y*), interval bounds*a*and*b*with*a < b*, and*c*and*d*with*c < d*, and input integer*n*≥ 1, does the following:- If
*n*is odd, it applies the multiple-application trapezoidal rule in

- If

each dimension to approximate.

- If
*n*is even, it applies the multiple-application Simpson’s 1/3 rule

in each dimension to approximate.

(b) Suppose the temperature T (^{o}C) at a point (*x,y*) on a 16 m^{2 }rectangular heated plate is given by

*T*(*x,y*) = *x*^{2 }− 3*y*^{2 }+ *xy *+ 72*,*

where −2 ≤ *x *≤ 2 and 0 ≤ *y *≤ 4 (here *x *and *y *are measured in meters about a reference point at (0*,*0)). Determine the average temperature of the plate:

- Analytically, to obtain a true value.
- Numerically, using the algorithm you developed in question 1(a) above, and plot the true percent relative error
as a function of_{t }*n*for 1 ≤*n*≤ 5. Provide some interpretation of the results.

- Write code for two separate algorithms to implement (a) Euler’s method and(b) the standard 4th order Runge-Kutta method, for solving a given first-order
**one-dimensional**Design the code to solve the ODE over a prescribed interval with a prescribed step size, taking the initial condition at the left end point of the interval as an input variable. - The drag force
*F*(N) exerted on a falling object can be modeled as proportional to the square of the objects downward velocity_{d }*v*(m/s), with a constant of proportionality*c*(kg/m)._{d }- Assume that a falling object has mass
*m*= 100 (kg) with a drag coefficient of*c*= 0_{d }*.*25 kg/m, and let*g*= 9*.*81 (m/s^{2}) denote the constant downward acceleration due to gravity near the surface of the earth. Starting from Newton’s second law, explain the derivation of the following ODE for the downward velocity*v*=*v*(*t*) of the falling object:

- Assume that a falling object has mass

*. *(1)

- Suppose that this same object is dropped from an initial height of
*y*_{0 }= 2 km. Determine when the object hits the ground by solving the ODE you derived in question 3(a) using- Euler’s method.
- the standard 4th order Runge-Kutta method.

**HINT: **Note that, with the velocity *v *oriented downward, the height *y *= *y*(*t*) satisfies . You are asked to find the final time *t _{f }*when the height

*y*of the falling object reaches zero, i.e. when

*y*(

*t*) = 0. There are two ways to solve this problem.

_{f}- You can use your algorithm for solving one-dimensional ODEs (Eulerand Runge-Kutta 4) from question 2 to solve the ODE (1) to find
*v*=*v*(*t*) (at discrete time points) with initial condition*v*(0) = 0. Then, you can use your one-dimensional ODE algorithms, again, to solve with initial condition*y*(0) = 2000 m, and try to identify when*y*(*t*) = 0._{f} - Alternatively, you can use your algorithm for solving two-dimensionalODEs (Euler and Runge-Kutta 4) from question 4 to solve the coupled

ODE system

*,*

with initial condition *y*(0) = 2000, *v*(0) = 0. Then, try to identify when *y*(*t _{f}*) = 0.

- Write code for two separate algorithms to implement (a) Euler’s method and(b) the standard 4th order Runge-Kutta method, for solving a given first-order
**two-dimensional**system of ODEs. Design the code to solve the system of ODEs over a prescribed interval with a prescribed step size. - The motion of a damped mass spring is described by the following ODE

*, *(2)

where *x *= displacement from equilibrium position (m), *t *= time (s), *m *= mass (kg), *k *= stiffness constant (N/m) and *c *= damping coefficient (N·s/m).

- Rewrite the 2nd order ODE (2) as a two-dimensional system of first orderODEs for the displacement
*x*=*x*(*t*) and velocity*v*=*v*(*t*) of the mass attached to the spring. - Assume that the mass is
*m*= 10 kg, the stiffness*k*= 12 N/m, the damping coefficient is*c*= 3 N·s/m, the initial velocity of the mass is zero (*v*(0) = 0), and the initial displacement is*x*= 1 m (*x*(0) = 1). Solve for the displacement and velocity of the mass over the time period 0 ≤*t*≤ 15, and plot your results for the displacement*x*=*x*(*t*),- using Euler’s method with step size
*h*= 0*.*5, and then with step size*h*= 0*.* - using the standard 4th order Runge-Kutta method with step size
*h*= 0*.*5, and then with step size*h*= 0*.*

- using Euler’s method with step size
- Assume that the mass is
*m*= 10 kg, the stiffness*k*= 12 N/m, the damping coefficient is*c*= 50 N·s/m, the initial velocity of the mass is zero (*v*(0) = 0), and the initial displacement is*x*= 1 m (*x*(0) = 1). Solve for the displacement and velocity of the mass over the time period 0 ≤*t*≤ 15, and plot your results for the displacement*x*=*x*(*t*),- using Euler’s method with step size
*h*= 0*.*5, and then with step size*h*= 0*.* - using the standard 4th order Runge-Kutta method with step size
*h*= 0*.*5, and then with step size*h*= 0*.*

- using Euler’s method with step size