Docsity

ME 2016 Midterm Exam 3 - Fall Semester 2006 - Computing Techniques 3-0-3, Exams of Computer Science

Toggle sidebar
bg1
Page 1
ME 2016 Section A-C
Fall Semester 2006
Computing Techniques 3-0-3
Midterm Exam 3
Wednesday, November 10, 2006
Section:
Name and email address:
READ THIS FIRST
This exam is a fifty-minute exam (the entire class period). The exam is closed book and
closed notes. A non-graphing pocket calculator can be used. You are on your honor not to
consult with your classmates. Cheating will not be tolerated and will result in immediate
and strict action.
Please feel free to use any pictures, graphs, flow charts, code fragments, or written comments in
describing your understanding of the problems and their solutions. Be sure to clearly state any
assumptions or conditions regarding the solution. Please write all of your answers on these
sheets. You may use the back of the paper if necessary. A total of 100 points are awarded.
An equation sheet is included on the last page of this exam.
Honor Code Statement:
My signature below indicates that I have read the above text. On my honor, I pledge that I have
neither given nor received inappropriate aid in the preparation of this examination. I also pledge
that I have not spoken with any students who have previously taken the ME 2016 exam today.
Further, I will not discuss this exam with any other student taking ME 2016 this semester who
has not yet taken the exam until after all the exams have been given (5PM on the day of the
exam).
Signature: _____________________________________________________________
Question Maximum Score Student’s Score
1 – True or False 10
2 – Short question 1 10
– Short question 2 10
– Short question 3 10
3 – Numerical integration 15
4 – ODE solving 30
5 – Matlab 15
TOTAL 100
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download ME 2016 Midterm Exam 3 - Fall Semester 2006 - Computing Techniques 3-0-3 and more Exams Computer Science in PDF only on Docsity!

ME 2016 Section A-C

Fall Semester 2006

Computing Techniques 3-0-

Midterm Exam 3

Wednesday, November 10, 2006

Section:

Name and email address:

READ THIS FIRST

This exam is a fifty-minute exam (the entire class period). The exam is closed book and

closed notes. A non-graphing pocket calculator can be used. You are on your honor not to

consult with your classmates. Cheating will not be tolerated and will result in immediate

and strict action.

Please feel free to use any pictures, graphs, flow charts, code fragments, or written comments in

describing your understanding of the problems and their solutions. Be sure to clearly state any

assumptions or conditions regarding the solution. Please write all of your answers on these

sheets. You may use the back of the paper if necessary. A total of 100 points are awarded.

An equation sheet is included on the last page of this exam.

Honor Code Statement:

My signature below indicates that I have read the above text. On my honor, I pledge that I have

neither given nor received inappropriate aid in the preparation of this examination. I also pledge

that I have not spoken with any students who have previously taken the ME 2016 exam today.

Further, I will not discuss this exam with any other student taking ME 2016 this semester who

has not yet taken the exam until after all the exams have been given (5PM on the day of the

exam).

Signature: _____________________________________________________________

Question Maximum Score Student’s Score

1 – True or False 10

2 – Short question 1 10

  • Short question 2 (^10)
  • Short question 3 (^10)

3 – Numerical integration 15

4 – ODE solving 30

5 – Matlab 15

TOTAL 100

Question 1: True or False (10 points; 2 points each)

Circle True or False. If False, briefly explain your reasoning

  1. If possible, Simpson 1/3 rather than Simpson 3/8 should be used to integrate a function

because Simpson 1/3 is generally more accurate.

True / False

  1. Because 5 3

dy y dt

= + is a linear differential equation, the first order Euler’s method will solve

it exactly.

True / False

  1. When solving an ordinary differential equation using any of the Runge-Kutta methods

discussed in class, the time step should be chosen sufficiently small otherwise the solution may

become unstable.

True / False

  1. Since Euler’s method is first order, the local propagation error is O(h).

True / False

  1. By applying an appropriate transformation, a higher-order differential equation can be

formulated as a system of first-order differential equations.

True / False

Question 3: Numerical Integration (15 points)

Consider the integral

7

0

I = f ( ) x dx

, where f(x) is shown below.

0 1 2 3 4 5 6 7

0

1

2

3

4

x

f(x)

Compute the integral as accurately as possible using only the given data.

x f(x)

Question 4: ODE solving (30 points total)

4.1. Problem Formulation (10 points)

While driving down the highway at 108 km/h (30m/s), a car suddenly runs out of gas, the engine

halts, and the car cruises to a stop. Provide a complete mathematical model that allows one to

compute the velocity of the car as a function of time, starting at the moment the engine stops.

The equation of motion is based on Newton’s law: mass times acceleration equals the sum of the

forces. In this case, there are two forces:

F drag = CD ρ Avcar

Frolling = μ rmg cos( α)

As in the homework assignments, you can assume that the car has the following parameters:

air density, ρ : 1.29 kg/m

3

drag coefficient, CD : 0.

frontal area of the car, A : 2.5 m

2

rolling coefficient, μ r : 0.

car mass, m : 1631 kg (includes occupants and cargo)

slope, α : 0 degrees

gravity constant, g : 9.81 m/s

2

4.2. Solving a differential equation (20 points)

Using a 4

th order Runge Kutta method, solve the following differential equation:

dy 2

y t

dt

= − + with y (0) = 2

Perform 2 iterations with a step size of 1 second each.

Question 5: Matlab Function (15 points)

The script below implements Heun’s method for solving the differential equation

5 sin( 1) 0

dy y t dt

    • = with y (0) = 1. However, the script contains several errors. Identify and

correct all mistakes of logic and syntax.

(Note: you get +3 points when you identify an error correctly, and -2 when you identify an error

where there is none — you can end up with a negative score for this question).

f = @(y,t)(y*sin(t+1)/5);

y_initial = 1;

num_steps = 1000;

start_time = 0;

end_time = 100;

y = zeros(1,num_steps);

t = linspace(start_time, end_time, num_steps);

h = (start_time - end_time)/num_steps;

y(0) = y_initial;

for i=1:num_steps

y_predicted = y(i) + f(y(i),t(i))*h;

y(i+1) = y(i) + f(y(i+1),t(i+1))*h;

end

plot(t,y);

grid on;

Equation Sheet

n

− = ×

with 1

e m b m b

with | |

x (^) t eps eps b x

( ) ( ) 2 ( ) ( ) ( ) ( )( ) ( ) ( ) 2!!

n n n

f a f a f x f a f a x a x a x a R n

( 1) ( ) 1 ( ) ( 1)!

n n n

f R x a n

= −

l u r

x x x

new old r r u^ l a new r u l

x x x x

x x x

0

n a n

x E

u l u r u l u

f x x x x x f x f x

1

i i i i

f x x x f x

+ =^ −^

2 , 1 ,

r t i t i r

f x E E f x

2

1

n

r i i

S e

= (^) ∑

2

1

n

t i i

S y y

= (^) ∑ − ( ) ( )

T T Z Z A = Z Y

(^1 2 ) ( )

i i i i

i i

n x y x y a n x x

∑ ∑ ∑

∑ ∑

a 0 (^) = y − a x 1 1

n

i i

x x n (^) =

= (^) ∑

2 t r

t

S S

r S

2 2 2 2

i i i i

i i i i

n x y x y r

n x x n y y

∑ ∑ ∑

∑ ∑ ∑ ∑

1 0 1 0 0 1 0

f x f x f x f x x x x x

1 1 1 2 0 1 1 0 0

[ , ,..., ] [ , ,..., ]

[ , ,..., , ]

n n n n n n n

f x x x f x x x f x x x x x x

− − − −

f (^) n ( ) x = f ( x 0 (^) ) + f x [ 1 (^) , x 0 (^) ]( x − x 0 (^) ) + f x [ 2 (^) , x 1 (^) , x 0 (^) ]( x − x 0 (^) )( x − x 1 (^) ) + f x [ (^) n , xn (^) − 1 ,..., x 0 (^) ]( x − x 0 (^) )( x − x 1 (^) )...( x − xn − 1 )

b b

n a a

I = f x dx ≅ f x dx ∫ ∫

f a f b I b a

3 ( ) ( ) 12

t

b a

E f ξ

1

0 1

n

i n i

f x f x f x

I b a n

−

=

∑ 3

2

t

b a E f n

f x f x f x I b a

5 ( ) (^) (4) ( ) 2880

t

b a

E f ξ