1. (10 points) Use the bisection method with tol = 10−12 to find ALL ZEROS in the interval [0, 1] for the following function: f(x) = x3 − (a1 − exp(a2x))x2 + a3x− a4 with a1 = 1.42, a2 = −7.89, a3 =...

1 answer below »
1. (10 points) Use the bisection method with tol = 10−12 to find ALL ZEROS in the
interval [0, 1] for the following function: f(x) = x3 − (a1 − exp(a2x))x2 + a3x− a4
with a1 = 1.42, a2 = −7.89, a3 = 0.52, a4 = XXXXXXXXXXPresent numerical results in a table
as follows:
Here, [a, b] is the starting interval used in the bisection method to compute the zero.
Put each zero found and the related computational data in one row. Use more rows if
more than one zero are found.
2. (10 points) Consider the following nonlinear function:
f(x) = sin
(
a1 + (a2 − exp(a3x))x2 + a4x3
)
.
(a) Use the secant method to compute the zeros of f in the interval [0, 1] with the
following parameters:
a_1 = 0.1; a_2 = -3.2; a_3 = -5; a_4 = -1;
Use the following inputs for the secant method:
tol = 10^(-12); nmax = 1000;
Present numerical results in a table as follows:
1
zero found a b Iterations Used
zero found Residual NOI
Add more rows for multiple zeros found. Present your script for generating these
numerical results. “NOI” in the table means the number of iteration actually
used by the method.
(b) Use Newton’s method to compute the zeros of f in the interval [0, 1] with the
following parameters:
a1 = 0.2; a2 = 4.5; a3 = -5; a4 = -1;
Use the following inputs for the Newton’s method:
tol = 10^(-12); nmax = 1000;
Present numerical results in a table as follows:
zero found Residual NOI
Add more rows for multiple zeros found. Present your script for generating these
numerical results. “NOI” in the table means the number of iteration actually
used by the method.
3. (30 points) Consider the following nonlinear system for p,Q1, Q2 and Q3:
Q1 +Q2 +Q3 = 0,
p
γ
+ c1sign(Q1)Q
2
1 + z1 = 0,
p
γ
+ c2sign(Q2)Q
2
2 + z2 = 0,
p
γ
+ c3sign(Q3)Q
2
3 + z3 = 0.
and sign(x) is the so called sign function whose values are 1 or 0 or −1 depending
whether x is positive, zero, or negative. We can put the given nonlinear system in the
vector form f(x) = 0 by setting
x =

x1
x2
x3
x4
 =

Q1
Q2
Q3
p

(a) (10 points) Implement f(x) in a Matlab function whose interface is as follows:
function f = fun_Qp(x, gam, c, z)
and implement the Jacobian of f(x) in a Matlab function whose interface is as
follows:
2
function J = fun_QpJ(x, gam, c, z)
where gam is for the value of γ, and c, z are vectors for
c = [c1, c2, c3]
T , z = [z1, z2, z3]
T .
(b) (10 points) Find approximations to Q1, Q2, Q3, p by using the Broyden’s method
with the initial matrix B0 specified in the following table to solve this nonlinear
system with parameters:
γ = 9791, z1 = −19, z2 = −7, z3 = 2,
c1 = 3.721, c2 = 64.55, c3 = 21.273.
Use the following inputs for the Broyden’s method:
x0 = [1; 1; 1; 1*10^5]; tol = 10^(-8); nmax = 200;
Present numerical results in the following table:
B0 Identity Matrix approxJ_fdh approxJ_compl
residual
number of iter.
Q2
p
Present the scripts for generating the numerical results in the table above. Among
the three choices for the initial matrix B0, which one is the best? Why? Is the
approximate Jacobian by the complex variable method a good approximation to
the exact Jacobian at the specified x0? Why? Why not?
(c) (10 points) Find approximations to Q1, Q2, Q3, p by using Newton’s method to
solve this nonlinear system with the following parameters:
γ = 9790, z1 = −19, z2 = −7, z3 = 2,
c1 = 3.73, c2 = 64.6, c3 = XXXXXXXXXX.
Use the following inputs for the Newton’s method:
x0 = [1; 1; 1; 1*10^5]; tol = 10^(-8); nmax = 200;
Present numerical results in the following table:
Q1
Q3
number of iterations
Are these approximation acceptable? Why or Why not?
3
4. (30 points) In designing the shape of a gravity-flow discharge chute that will minimize
transit time of discharged granular particles, we need to solve the following system of
nonlinear equations:
sin(θn+1)
vn+1
− sin(θn)
vn
= 0, n = 1, 2, · · · , 19,
∆y
∑20
i=1
tan(θi)−X = 0,
X, ∆y, vn, n = 1, 2, · · · , 20 are parameters to be specified.
(a) (10 points) Put this nonlinear system in vector form f(θ) = 0, in which
θ = (θ1, θ2, · · · , θ20)T .
Then, implement Matlab functions for this nonlinear function and its Jacobian
such that their interfaces are as follows:
function f = fun_gravity_flow(theta, v, X, Del_y)
function J = fun_gravity_flow_J(theta, v, X, Del_y)
Then, assume the parameters in this nonlinear system are such that
g = 32.16 ft/s2, X = 1.9, ∆y = 0.19,
vn =

2gn∆y, n = 1, 2, · · · , 20.
Use your Matlab functions to compute f(θ(0)) and Jf (θ
(0)) where
θ(0) = (1, 2, 3, · · · , 20)T .
Present numerical results in the following table:
f11(θ
(0))
f20(θ
(0))
J(13, 13)
J(13, 14)
J(13, 16)
J(20, 16)
(b) (10 points) Use Newton’s method to solve this nonlinear system with the param-
eters specified in Problem 4a. Use the following inputs for Newton’s method:
theta0 = ones(20, 1); tol = 10^(-12); nmax = 200;
Present numerical results in a table as follows:
4
θ3
θ13
θ18
Residual
Number of iterations
Also, preset the related Matlab script.
(c) (10 points) Use Broyden’s method to this nonlinear system with the following
parameters: Assume
g = 32.16 ft/s2, X = 1.98,∆y = 0.251,
vn =

2g(n+ 1/n)∆y, n = 1, 2, · · · , 20.
Use the following inputs for the Broyden’s method:
theta0 = ones(20, 1); tol = 10^(-12); nmax = 200;
Justify the choice for the initial matrix B0 to be used in the Broyden’s method.
Present numerical results in a table as follows:
θ1
θ11
θ17
Residual
Number of iterations
Also, preset the related Matlab script.
5. (40 points) Consider the following nonlinear equations for ui, i = 1, 2, · · · , N :
−2u1 + u2 + h2u21 − h2g1 = 0,
ui−1 − 2ui + ui+1 + h2u2i − h2gi = 0, i = 2, 3, · · · , N − 1,
uN−1 − 2uN + h2u2N − h2gN = 0,
where
h =
1
N + 1
,
x1 = h, xi = xi−1 + h, i = 2, 3, · · · , N,
gi = e
−2xi
(
sin(xi)
(
e2xi + (e− exi)2 sin(xi)
)
− 2exi+1 cos(xi)
)
(a) (10 points) Let u = (u1, u2, · · · , uN)t be the unknown vector for the nonlinear
system above. Implement the nonlinear function f(u) = 0 such that its interface
is as follows:
function f = fu(u, g, h)
5
Then implement the Jacobian for this nonlinear system such that its interface is
as follows:
function J = fu_J(u, g, h)
Then, for N = 5, carry out computations to fill in the following table:
f1(u
(0))
f3(u
(0))
J(2, 2)
J(2, 3)
J(2, 4)
J̃(3, 3)
J̃(3, 2)
J̃(3, 1)
where u(0) = [1, 1, 1, 1, 1]T , J is Jacobian of f , and J̃ is the approximate Jacobian
by the complex variable method with EPS = 10^(-6).
(b) (10 points) Solve this nonlinear system for N = 512 by Newton’s method. Present
your numerical results by filling the following table:
u15
u305
Residual
Iterations used
Use
tol = 10−12, u(0) =

1
1
...
1

Also, present your Maltab script used to generate data in this table. Make sure
that your script uses the Matlab’s “varargin” functionality.
(c) (10 points) Solve this nonlinear system for N = 1024 by Broyden’s method.
Present your numerical results by filling the following table:
u512
u750
Residual
Iterations used
6
Use
tol = 10−12, u(0) =

1
1
...
1

Also, present your Maltab script used to generate data in this table. Make sure
that your script uses the Matlab’s “varargin” functionality.
(d) (10 points) Note that the solution in part 5b above provide data for a function
u(x). Use this set of data to find approximations to u(x) and present these
approximations in the following table:
x u(x)
π/8
π/4
Justify your choice of the method for computing these approximations and present
the related script.
6. (40 points) Consider the following data for the trajectory in the x-y plane of a robot
(from Problem 3.4 and Example 3.10):
t XXXXXXXXXX
x XXXXXXXXXX
y XXXXXXXXXX
Let
T1(t) =
[
x1(t)
y1(t)
]
, t ∈ [0, 2], T2(t) =
[
x2(t)
y2(t)
]
, t ∈ [2, 5]
be the cubic spline interpolations with the natural boundary condition of the trajectory
data in corresponding time intervals. Then download data file
curve_intersects_RobotTraj.mat
from Canvas for the trajectory of another moving object, and let
T3(s) =
[
x3(s)
y3(s)
]
, s ∈ [0, 5]
be the cubic spline interpolation with the natural boundary condition for this set of
data. In these functions, both t and s variables represent the time.
7
(a) (10 points) Make a plot of the trajectories by the three parametric curves defined
above with red, blue, and green color, respectively.
(b) (10 points) Find the x-y coordinates where T3(s) curve intersects with the T1(t)
curve. Present your results in the following table
x
y
t∗
s∗
where
T1(t
∗) =
[
x
y
]
= T3(s
∗).
8
(c) (10 points) Find the x-y coordinates where T3(s) curve intersects with the T2(t)
curve. Present your results in the following table
x
y
t∗
s∗
where
T2(t
∗) =
[
x
y
]
= T3(s
∗).
(d) (5 points) Make a plot of the trajectories by the three parametric curves defined
above with red, blue, and green color, respectively, together with the intersection
points found above. Mark the two intersection points with red *.
(e) (5 points) Discuss the concern about whether the moving object can collide with
the robot. Why? Why not?
Answered 1 days AfterMay 17, 2021

Solution

Hanumantha Rao M answered on May 18 2021
20 Votes

1. Bisection method:Figure 1: Screenshot using bisection method.
Using the matlab file...

Submit New Assignment

Copy and Paste Your Assignment Here