Docsity

Assignment 1 Solution - Numerical Methods | EAD 115, Assignments of Engineering

Toggle sidebar
bg1
University of California, Davis
Department of Applied Science
Spring 2008
David M. Rocke
Numerical Methods EAD 115
April 3, 2008
Homework Assignment 1
Due April 10, 2008
1. Determine machine epsilon in both double and single precision for Excel Visual
Basic. Here is a program to do this in single precision:
Option Explicit
Function MachEps()
Dim eps As Single, eps1 As Single, eps2 As Single
eps = 1
Do
eps1 = 1 + eps
eps2 = eps1 - 1
If (eps2 <= 0) Then
Exit Do
End If
eps = eps / 2
Loop
MachEps = eps
End Function
Please provide a copy of the double precision code, and the two machine epsilon
values for single and double precision.
2. Do the following problems from the text: 4.2, 4.4, 4.6โ€“4.9.

Partial preview of the text

Download Assignment 1 Solution - Numerical Methods | EAD 115 and more Assignments Engineering in PDF only on Docsity!

University of California, Davis

Department of Applied Science

Spring 2008 David M. Rocke

Numerical Methods EAD 115

April 3, 2008

Homework Assignment 1 Due April 10, 2008

  1. Determine machine epsilon in both double and single precision for Excel Visual Basic. Here is a program to do this in single precision:

Option Explicit Function MachEps() Dim eps As Single, eps1 As Single, eps2 As Single eps = 1 Do eps1 = 1 + eps eps2 = eps1 - 1 If (eps2 <= 0) Then Exit Do End If eps = eps / 2 Loop MachEps = eps End Function

Please provide a copy of the double precision code, and the two machine epsilon values for single and double precision.

  1. Do the following problems from the text: 4.2, 4.4, 4.6โ€“4.9.