Question
question 3 please

The first 5 questions refer to finding solutions to the equation exp(w) = 3.8 ln(1+x). You will need to write it in the form f(x)-0, and use various root finding methods. 1. (10 pts) Plot the curves y- exp(Vx), and y 3.8 ln(1+x) on the same graph in the range 0 x 6. Read off intervals in which there are roots of the equation exp(k)- 3.8 In(1+x) Now find the roots to 6 decimal places using the bisection method (write a program). Print the root found, the value of the function at the root, and the number of iterations required. Use double precision 2. (10 pts) Write a C or Java program to use Newtons method to find a root to an accuracy of 10Use starting values 0.5, 1.6, 1.8, and 3.2, and print all iterations, the roots found, the value of the function at the root, and the number of iterations required. Use double precision 3. (20 pts) We want to compare inverse quadratic interpolation with the results of questions 1 and 2. Using the same function, use inverse quadratic interpolation to find a root between 1.6 and 3.2, printing each iteration. Use starting values x11.6 and x2 3.2. Inverse Quadratic Interpolation x3 0.5* (xi +x2) fit a quadratic x-x(y) through (yl,xl ), (y2.x2), and (y3x3) Use the Lagrange polynomial set y-0 to get x4 discard the xi and xj with the largest fx) I rename the remaining values as x1 and x2 and repeat
0 0
Add a comment Improve this question Transcribed image text
Answer #1

clc%clears screen
clear all%clears history
close all%closes all open files
format long
fplot(@(x) exp(sqrt(x)),[0 6],'b');
hold on;
fplot(@(x) 3.8*log(1+x),[0 6],'r');
legend('exp(sqrt(x))','3.8*log(1+x)');

f=@(x) exp(sqrt(x))-3.8*log(1+x);
e=1e-6;
a=[1 2];
b=[2 3];
for i=1:2
    iter(i) = 0;

if f(a(i))*f(b(i))>=0

                disp('No Root')

else

                prev = (a(i)+b(i))/2;
                p=a(i);
                while (abs(f(p))>e)
                    prev=p;

                                 iter =iter+ 1;

                                p = (a(i)+b(i))/2;

                                if f(p) == 0

                                                break;

                                end

                                if f(a(i))*f(p)<0

                                                b(i) = p;

                                else

                                                a(i) = p;

                                end

                end

end
    fprintf('Number of Iteration %d, root= %.6f and value of function at root= %.10f\n',iter(i),p,f(p));

end

PROOF:

pre 22413 Nusber ot Iceration 17, E0 1.184746 andalue or tunocion at oo- 0.0000000418 Nunber of Iceration 18. ro02.241a14 and alue of tunesion at roo--9000001308

Add a comment
Know the answer?
Add Answer to:
question 3 please The first 5 questions refer to finding solutions to the equation exp(w) =...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1...

    1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1 mark) (b) Apply two iterations of the bisection method to f(x) 0 to find the positive root. (3 marks) (c) Apply two iterations of the Newton-Raphson method to find the positive root. Choose (3 marks) (d) Use the Newton-Raphson method and Matlab to find the positive root to 15 significant (3 marks) (a) Use Matlab to obtain a graph of the function that shows...

  • i need the answer to be on a MatLab window 1. Consider the following equation, which...

    i need the answer to be on a MatLab window 1. Consider the following equation, which represents the concentration (c, in mg/ml) of a drug in the bloodstream over time (t, in seconds). Assume we are interested in a concentration of c2 mg/ml C3te-0.4t A. Estimate the times at which the concentration is 2 mg/ml using a graphical method Be sure to show your plot(s). Hint: There are 2 real solutions B. Use MATLAB to apply the secant method (e.g....

  • Not in C++, only C code please In class, we have studied the bisection method for...

    Not in C++, only C code please In class, we have studied the bisection method for finding a root of an equation. Another method for finding a root, Newton's method, usually converges to a solution even faster than the bisection method, if it converges at all. Newton's method starts with an initial guess for a root, xo, and then generates successive approximate roots X1, X2, .... Xj, Xj+1, .... using the iterative formula: f(x;) X;+1 = x; - f'(x;) Where...

  • DQuestion 19 28 pts Problem 2. Quadratic Equations A quadratic equation has the form: a bc0 The two solutions are given by the formula: 2a Write a program with a loop that a) solves quadratic equatio...

    DQuestion 19 28 pts Problem 2. Quadratic Equations A quadratic equation has the form: a bc0 The two solutions are given by the formula: 2a Write a program with a loop that a) solves quadratic equations with coefficients read from the terminal, b) visualizes the corresponding quadratic function az2 brc0using the matplotlib module. Instructions Write all code for this problem in a file p2.py 1. The program consists of a main whtle loop (an infinite loop) in which the user...

  • Code in R Part 1. a) Run the following lines: n<-30 x<-matrix(rnorm(n * 1000), 1000,n) xL,1:3]<-xl,1:3]*10...

    Code in R Part 1. a) Run the following lines: n<-30 x<-matrix(rnorm(n * 1000), 1000,n) xL,1:3]<-xl,1:3]*10 y<-1+matrix(rnorm (n * 1000), 1000, n) Note: the samples in "x" are contaminated. b) Conduct 1000 two-sample two-sided t-tests for the associated rows of "xand "". (e.g., for the first test, the two samples are "x[1," and "y[1,]", for the second test, the two samples are "x[2," and "y[2,1",etc.). Calculate the total number of rejections of the 1000 tests. (Use significant level a =...

  • Please, I need help answering questions 10, 11, 12, 13, 14, and 15. Use the other...

    Please, I need help answering questions 10, 11, 12, 13, 14, and 15. Use the other pages as information to solve the questions. Use the questions below to keep track of key concepts from this lesson's study activity. YOUR ASSIGNMENT: Splatapults Away! The engineering club has built a catapult and wants to test it out. The local supermarket has donated some overripe fruits and vegetables, and now the club is holding a Splatapult challenge to see who can hit the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT