ROSE-HULMAN INSTITUTE OF TECHNOLOGY

ME 323  Computer Applications II --- Spring 2008–2009

 

 

Class

Date

Answers (Numerical values only)

Due Date

Lab 1

3-11

Problem 1

(a)  The total fluid volume is 8.48230e+001 cubic meters at a fluid level of 3.000e+000 meters.

(b)  The total fluid volume is 2.09440e+002 cubic meters at a fluid level of 5.500e+000 meters.

(c)  The total fluid volume is 3.61107e+002 cubic meters at a fluid level of 9.200e+000 meters.

End of Lab 1

Lab 2 3-18

Problem 1

Number of rectangles

Error

10 -2.9868e+000
100 -3.0179e-002
1000 -3.0182e-004
10000 -3.0181e-006
100000 -2.9253e-008

 

Problem 2

Number of trapezoids

Error

10 6.0005e+000
100 6.0361e-002
1000 6.0364e-004
10000 6.0365e-006
100000 6.1294e-008

 

Problem 3

Number of sub-intervals

Error

10 8.9585e-003
100 9.0537e-007
1000 8.5976e-011
10000 8.6658e-011
100000 9.2930e-010

End of Lab 2

Lab 3 3-25

Problem 1

 Lower bound of searching interval =  0.0001

 Upper bound of searching interval =  0.1

 Error tolerance for solution      =  0.000001

 

 Solution to the equation is found at x = 1.9988996e-002.

 It takes   16 iterations to converge with an accuracy of 7.6218e-007.

 

 

Problem 2

 What is the fluid volume, in cubic meter = 360

 What is the error tolerance, in meter    = 0.001

 

 Solution to the equation is found at x = 9.1412354e+000.

 It takes   13 iterations to converge with an accuracy of 6.1035e-004

End of Lab 3

Lab 4 4-1

Friction factor in pipe flow analysis

Initial guess of solution    =  0.01

Error tolerance for solution =  10^(-6)

 

 Iteration         x               f           error

 ---------------------------------------------------------

     1       1.0000000e-002     3.18e+000     5.96e-003

     2       1.5959584e-002     9.23e-001     3.44e-003

     3       1.9396281e-002     1.18e-001     5.85e-004

     4       1.9980782e-002     1.69e-003     8.77e-006

     5       1.9989550e-002    -1.18e-005    -6.13e-008

 

A solution is found to be at x =  1.9989488e-002.

It takes   5 iterations to converge with an accuracy of 1.0000e-006.

 

 

Inverse problem of tank exercise 

What is the fluid volume, in cubic meter = 300

What is the error tolerance, in meter    = 10^(-6)

Initial guess of solution                = 5.0

 

 Iteration         x               f           error

 ---------------------------------------------------------

     1       5.0000000e+000    -1.16e+002     2.30e+000

     2       7.3016437e+000    -2.31e+000     5.17e-002

     3       7.3533799e+000     4.65e-003    -1.05e-004

     4       7.3532748e+000    -3.35e-005     7.58e-007

 

Fluid level is found to be 7.3532755e+000 m for a volume of 3.00e+002 m^3.

It takes    4 iterations to converge with an accuracy of 7.5826e-007 m.

End of Lab 4

Lab 6 4-22

Case 1:

 Initial guess of solution    =  [2.0 0.0]'

 Error tolerance for solution =  10^(-6)

 

 Iteration      dx(1)         dx(2)         f(1)          f(2)

 ------------------------------------------------------------------

     1        0.00e+000    -6.39e+000     0.00e+000     6.39e+000

     2       -4.15e-001     3.06e+000     4.08e+001     0.00e+000

     3       -3.72e-001     1.26e+000     9.56e+000     5.56e-001

     4       -1.82e-001     3.12e-001     1.73e+000     3.00e-001

     5       -2.64e-002     2.17e-002     1.30e-001     5.24e-002

     6       -3.95e-004     1.08e-004     1.17e-003     9.71e-004

     7       -7.90e-008     2.63e-009     1.68e-007     2.13e-007

 

 Solution to the equations is at x =  1.004169e+000, y = -1.729637e+000.

 It takes    7 iterations to converge with an accuracy of 1.0000e-006.

 

Case 2:

 Initial guess of solution    =  [-2.0 0.0]'

 Error tolerance for solution =  10^(-6)

 

 Iteration      dx(1)         dx(2)         f(1)          f(2)

 ------------------------------------------------------------------

     1        0.00e+000     8.65e-001     0.00e+000    -8.65e-001

     2        1.77e-001    -2.39e-002     7.48e-001     0.00e+000

     3        7.14e-003    -3.39e-003     3.18e-002     2.24e-003

     4        1.42e-005    -6.44e-006     6.25e-005     4.13e-006

     5        5.55e-011    -2.55e-011     2.44e-010     1.65e-011

 

 Solution to the equations is at x = -1.816264e+000, y =  8.373678e-001.

 It takes    5 iterations to converge with an accuracy of 1.0000e-006.

End of Lab 6

Lab 7 4-29

 Error tolerance for solution (in K) =  0.001

 Number of evenly-spaced sections    = 4

 

 Iteration      max error

 -----------------------------------

     1          5.96e+002

     2          9.62e+000

     3          1.48e-002

     4          3.41e-008

 

 T(1) =  6.000000e+002 K.

 T(2) =  5.937795e+002 K.

 T(3) =  5.893895e+002 K.

 T(4) =  5.867763e+002 K.

 T(5) =  5.859086e+002 K.

 T(6) =  5.867763e+002 K.

 

 It takes    4 iterations to converge with an accuracy of 1.0000e-003.

End of Lab 7

Lab 8 5-6

Activity 1:

 Time step       y(x = 5)       Error at x = 5
       1      285.434237005    
-5.39208e+000
     0.1      290.825180205    
-1.13800e-003
    0.01      290.826318083    
-1.22652e-007
   0.001      290.826318205    
-1.70530e-011
  0.0001      290.826318205    
-1.48930e-011  (may differ depending on machine precision)

 

Activity 2:

 Step size for integration = 0.10

 Arrival time = 7.500000 sec, Range = 148.320403587 m.

End of Lab 8

Lab 9 5-13

Case 1:

 Horizontal location of target (in m)   =  100

 Vertical   location of target (in m)   =  30

 Initial guess of launch angle (in deg) =  45

 Error tolerance for solution (in deg)  =  0.001

 Time step for integration (in sec)     =  0.001

 

 Iteration       angle (deg)         f (m)           error (deg) 
 -------------------------------------------------------------------
     1         4.5000000e+001    5.2971260e+001    -2.7017235e+001
     2         1.7982765e+001   -1.7066823e+000     9.3348619e-001
     3         1.8916251e+001    4.6178411e-003    -2.5086618e-003
     4         1.8913743e+001    3.4611180e-006    -1.8803026e-006 

 Launch angle =  18.9137408 degrees to hit a target at x = 100.0000 m, y =  30.0000 m.

 

 

Case 2:

 Horizontal location of target (in m)   =  140

 Vertical   location of target (in m)   =  20

 Initial guess of launch angle (in deg) =  45

 Error tolerance for solution (in deg)  =  0.001

 Time step for integration (in sec)     =  0.001

 

 Iteration       angle (deg)         f (m)           error (deg) 
 -------------------------------------------------------------------
     1         4.5000000e+001   -1.4855484e+001    -8.0215790e-001
     2         4.4197842e+001   -3.8436720e+000    -3.0471401e-001
     3         4.3893128e+001   -5.5332264e-001    -4.9831670e-002
     4         4.3843296e+001   -5.1859136e-002    -4.7654872e-003
     5         4.3838531e+001   -4.4078581e-003    -4.0582886e-004 

 Launch angle =  43.8381251 degrees to hit a target at x = 140.0000 m, y =  20.0000 m.

End of Lab 9