Uploaded by Will Yglesias

Intro to Numerical MethodsHW3

advertisement
HOMEWORK ASSIGNMENT 3
EGM 3344
Root Finding
Problems from Chapra book chapters 5-6
Assigned:
1/26/2024
Due:
2/2/2024
For all of these problems, feel free to use a simple Matlab program to calculate function values
(like using a calculator) when the indicated approach is “by hand”. By "Hand" simply means that
you DO NOT need to use Matlab to solve the problem. You can use command window as a
calculator to work on your problems or you can write a code for the problem if you like.
If the designated approach is “Matlab”, you need to use Matlab to perform calculation. And you
have to attach the code if you write/use one.
When you use Matlab to perform computations, either in the command window or using
Matlab codes, please note that they do not represent your work. You may get 0 credit if
you simply pasted some commands after problem statement or attach a code without
much writeup because TA/Grader is not obligated to open your code and commands
without explanation are difficult to understand. You must formulate the problem, report
the numerical results, and analyze/interpret/discuss your results (if possible). You can
copy/paste your “commands” from the command window after you have formulated the
problem. Be consistent about notations between the formulation and Matlab commands.
For short Matlab codes or commands used in Command window, use “copy & paste” to
place them in the word document. Do not take screen shots.
Matlab code attached is only a means to confirm that you indeed did the computation.
Problem
Approach
Comments
5.15
Matlab
6.1
Hand
6.4*
(worth 20
pts)
Hand
6.11
Matlab
Use or modify the Matlab bisection program you wrote for
problem 5.9 to solve this problem.
Output your intermediate results to a table like in the answers
below.
Make the plot in part (a) using Matlab and use the plot to
estimate an initial guess for the root. Do the rest of the problem
by hand starting with a guess of 0.3. Skip part (c). For part (d),
put your intermediate results in a table like in the answers below.
USE initial guess x0=3.2
S1
Matlab
Sketch the curve and examine how poorly f(x) behaves.
* Prob. 6.4 is worth 20 points
2
Problem 5.15 Figure P5.15a shows a uniform beam subject to a linearly increasing distributed load. The
equation for the resulting elastic curve is (see Fig. P5.15b)
Use bisection to determine the point of maximum deflection (i.e., the value of x where dy/dx = 0). Then
substitute this value into Eq. (P5.15) to determine the value of the maximum deflection. Use the following
parameter values in your computation: L = 600 cm, E = 50,000 kN/cm2, I = 30,000 cm4, and w0 = 2.5
kN/cm.
Problem 6.1 Employ fixed-point iteration to locate the root of
f(x)= sin( x ) - x
Use an initial guess of x0 = 0.5 and iterate until εa ≤ 0.01%.
Verify that the process is linearly convergent as described at the end of Sec. 6.1.
Problem 6.4 Determine the lowest positive root of f(x) = 7 sin(x) e−x − 1:
(a) Graphically.
(b) Using the Newton-Raphson method (three iterations, x0 = 0.3).
(c) Using the secant method (three iterations, x-1 = 0.5 and x0 = 0.4.
(d) Using the modified secant method (five iterations, x0 = 0.3, δ = 0.01).
Problem 6.11 (a) Apply the Newton-Raphson method to the function f (x) = tanh(x2 − 9) to evaluate its
known real root at x = 3. Use an initial guess of x0 = 3.2 and take a minimum of three iterations.
(b) Did the method exhibit convergence onto its real root? Sketch the plot with the results for each
iteration labeled.
S1:
a) Use built-in Matlab function fzero to find the root of f(x) = x2|sinx|-4=0, initial guess x0=0.5.
b) Use false-position method to find the root of f(x)= x2|sinx|-4=0, initial guess [a, b]=[0, 4].
Accept your result when |f(xi)|<5*10-7. Print out all iterations of xi and f(xi).
Answers:
5.15
x = 268.328
ymax = -0.51519
6.1
3
6.4 (worth 20 points)
(a)
(b) Newton-Raphson
…
x2= 0.169409
x3=0.170179
(c) Secant method
…
x2= 0.218237
x3=0.178989
(d) Modified Secant
First iteration:
4
x0=0.3
x0+x0 = 0.303
f(x0)=0.532487
f(x0+x0) = 0.542708
x1= 0.143698
x2= 0.169412
x3= 0.17018085
6.11
Iteration
xi
f(xi)
f’(xi)
relative error
0
3.2
0.845456
1.825311
…
1
2.736816
…
…
…
2
3.670197
…
…
…
3
-256.413
b)
The solution does not converge. You need to find out why.
…
S1
a)
ans =
3.478508515574645
b)
N
1
2
…
35
…
xn
1.32134871
1.91485766
…
3.47847469
…
.
f(xn)
-2.308077
-0.548215
…
4.6408e-04
…
Download