- (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
each dimension to approximate.
- If n is even, it applies the multiple-application Simpsons 1/3 rule
in each dimension to approximate.
(b) Suppose the temperature T (oC) at a point (x,y) on a 16 m2 rectangular heated plate is given by
T(x,y) = x2 3y2 + 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 t as a function of n for 1 n 5. Provide some interpretation of the results.
- Write code for two separate algorithms to implement (a) Eulers 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 Fd (N) exerted on a falling object can be modeled as proportional to the square of the objects downward velocity v (m/s), with a constant of proportionality cd (kg/m).
- Assume that a falling object has mass m = 100 (kg) with a drag coefficient of cd = 0.25 kg/m, and let g = 9.81 (m/s2) denote the constant downward acceleration due to gravity near the surface of the earth. Starting from Newtons second law, explain the derivation of the following ODE for the downward velocity v = v(t) of the falling object:
. (1)
- Suppose that this same object is dropped from an initial height of y0 = 2 km. Determine when the object hits the ground by solving the ODE you derived in question 3(a) using
- Eulers 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 tf when the height y of the falling object reaches zero, i.e. when y(tf) = 0. There are two ways to solve this problem.
- 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(tf) = 0.
- 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(tf) = 0.
- Write code for two separate algorithms to implement (a) Eulers 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 (Ns/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 Ns/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 Eulers method with step size h = 0.5, and then with step size h = 0.
- using the standard 4th order Runge-Kutta method with step sizeh = 0.5, and then with step size h = 0.
- Assume that the mass is m = 10 kg, the stiffness k = 12 N/m, the damping coefficient is c = 50 Ns/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 Eulers method with step size h = 0.5, and then with step size h = 0.
- using the standard 4th order Runge-Kutta method with step sizeh = 0.5, and then with step size h = 0.
Reviews
There are no reviews yet.