Docsity

Practice Quiz 7 on Computational Methods - Fall 2007 | CMSC 460, Quizzes of Computer Science

Toggle sidebar
bg1
AMSC/CMSC 460 Quiz 7 ,Fall 2007
Show all work. You may leave arithmetic expressions in any form that
a calculator could evaluate. By putting your name on this paper, you agree
to abide by the university’s code of academic integrity in completing the
quiz. Use no books, calculators, cellphones, communication with others,
scratchpaper, etc.
Name
1. (10) Write Matlab code to use fzero to find an approximate solution to
the problem
F(x) = Zx
0
g(t)dt = 5.
You may assume that there is a Matlab function g.m that evaluates g(t),
that F(1) <5 and that F(2) >5. Recall that fzero finds a point xso that
f(x) = 0. It takes two arguments: the first defines the function fand the
second is a vector of length 2 where fevaluated at the first component differs
in sign from fevaluated at the second.
1
pf2

Partial preview of the text

Download Practice Quiz 7 on Computational Methods - Fall 2007 | CMSC 460 and more Quizzes Computer Science in PDF only on Docsity!

AMSC/CMSC 460 Quiz 7 , Fall 2007

Show all work. You may leave arithmetic expressions in any form that a calculator could evaluate. By putting your name on this paper, you agree to abide by the university’s code of academic integrity in completing the quiz. Use no books, calculators, cellphones, communication with others, scratchpaper, etc.

Name

  1. (10) Write Matlab code to use fzero to find an approximate solution to the problem

F (x) =

∫ (^) x

0

g(t)dt = 5.

You may assume that there is a Matlab function g.m that evaluates g(t), that F (1) < 5 and that F (2) > 5. Recall that fzero finds a point x so that f (x) = 0. It takes two arguments: the first defines the function f and the second is a vector of length 2 where f evaluated at the first component differs in sign from f evaluated at the second.

  1. (10) Apply one step of Newton’s method to solve the nonlinear equation

[ x^21 + x^22 − 1 cos(x 2 )

]

[

]

using a starting guess of x 1 = 1/2, x 2 = π/4. Your answer should be either two numbers (the values of x 1 and x 2 after the iteration), or computable formulas that Matlab could use to get these numbers. (Recall that cos(π/4) = sin(π/4) =