Question

script for Secant Method. Using Octave. The data: y = x.^2 - 1.2 x_lower = 0.4...

script for Secant Method. Using Octave.

The data:

y = x.^2 - 1.2

x_lower = 0.4

x_upper = 0.6


Es = 0.5*10^(2-n)

n = 5

Homework Answers

Answer #1

Execute the following MATLAB code:

syms x
y=inline(x^2-1.2); %Define function y

x(1)=0.4; %x_lower
x(2)=0.6; %x_upper

n=5;
Es=0.5*10^(2-n); %Allowed error
iter=0; %Initiate the value of iteration with zero

for i=3:1000
x(i) = x(i-1) - (y(x(i-1)))*((x(i-1) - x(i-2))/(y(x(i-1)) - y(x(i-2))));
iter=iter+1;
if abs((x(i)-x(i-1))/x(i))*100<Es
root=x(i); %root in fraction
vpa(root,4) %root into decimal from fraction
iter=iter %number of iterations
break
end
end

Obtain the following output:

ans =

1.095

iter =

6

Conclusion:

The value of "x" is 1.095 using secant method.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros(...
Using the Script: function EulerMethod1(n) X = 0 : 1/n : 1 ; Y = zeros( 1, n + 1 ) ; Y(1) = 1 ; for k = 1 : n m = Y(k) ; Y(k + 1) = Y(k) + m*( X(k + 1) - X(k) ) ; end clf plot( X, Y ) Create a new script, which defines the function EulerMethod2. The purpose of EulerMethod2 is to use Euler's Method to approximate the solution to the...
Using the secant method, find the roots of the following. x=e-x. Carry out the method to...
Using the secant method, find the roots of the following. x=e-x. Carry out the method to find three approximations.
Let f(x)=sin(x)+x^3-2. Use the secant method to find a root of f(x) using initial guesses x0=1...
Let f(x)=sin(x)+x^3-2. Use the secant method to find a root of f(x) using initial guesses x0=1 and x1=4. Continue until two consecutive x values agree in the first 2 decimal places.
X - Bernoulli (0.4) Y - Binomial (n = 10, p = 0.4) Z - Binomial...
X - Bernoulli (0.4) Y - Binomial (n = 10, p = 0.4) Z - Binomial (n = 3, p = 0.4); X, Y, Z all independent; find pmf of W = X + Y + Z
refer to the graph of y=f(x)=x^2+x shown a. Find the slope of the secant line joining(-3,f(-3))...
refer to the graph of y=f(x)=x^2+x shown a. Find the slope of the secant line joining(-3,f(-3)) and (0,f(0)) b. Find the slope of the secant line joining (-3,f(-3)) and(-3+h,f(-3+h)) c . Find the slope of the graph at (-3,f(-3)) d. Find the equation of the tangent line to the graph at (-3,f(-3))
Use Euler's method to approximate y(1.2), where y(x) is the solution of the initial-value problem x2y''...
Use Euler's method to approximate y(1.2), where y(x) is the solution of the initial-value problem x2y'' − 2xy' + 2y = 0,  y(1) = 9,  y'(1) = 9, where x > 0. Use h = 0.1. Find the analytic solution of the problem, and compare the actual value of y(1.2) with y2. (Round your answers to four decimal places.) y(1.2) ≈     (Euler approximation) y(1.2) =     (exact value)
Use Euler's method with step size 0.4 to estimate y ( 0.8 ) , where y...
Use Euler's method with step size 0.4 to estimate y ( 0.8 ) , where y ( x ) is the solution of the initial-value problem y' = 4x + y^2 , y ( 0 ) = 0 . y ( 0.8 ) =_____________________
You have collected data that are exponentially distributed:  pdf f(x)= θexp(-xθ), x>0. 0.1, 0.2, 0.3, 0.4, 0.5,...
You have collected data that are exponentially distributed:  pdf f(x)= θexp(-xθ), x>0. 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, and 1.0. 1) Determine the maximum likelihood estimation of θ. 2) Implement the central limit theorem to obtain a 95% CI for θ.
Write a R script where you answer the following questions: 1. Consider Y ∼ Binom(n =...
Write a R script where you answer the following questions: 1. Consider Y ∼ Binom(n = 10, p = 0.05). Find the following probabilities: (a) P(2 < Y < 5) (b) P(2 ≤ Y ≤ 5) (c) P(Y < 9) 2. Consider Y ∼ P oisson(λ = 0.5). Find the following probabilities: (a) P(Y = 5) (b) P(2 ≤ Y ≤ 5) (c) P(Y < 9) 3. Consider Y ∼ N(µ = 3, σ2 = 1). Find the following probabilities:...
1.Consider portfolios that can be formed using the stock X and Y with the necessary information...
1.Consider portfolios that can be formed using the stock X and Y with the necessary information in the following table. The risk-free rate is 1%. Determine the Sharpe ratio of the portfolio with the weight of 0.6 on X and 0.4 on Y. RETURN ON X (%). RETURN ON Y (%) MEAN 6 10 STANDARD DEVIATION 8 12 CORRELATION 0.2
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT