Question

1. Write a computer program to solve the equation x = tan x by means of Newtons method. Find the roots nearest 4.5 and 7.7. ( 2. (Continuation) Write and test a program to compute the first ten roots of the equation tan x =x. (This is much more difficult than the preceding computer problem.) Cultural note: If a1, a2, ... are all the positive roots of this equation, then Zie A2 = 1/10. (Amer. Math. Monthly, Oct. 1986, p. 660.)question number 2

1 0
Add a comment Improve this question Transcribed image text
Answer #1

roots = [0]; % record the obvious root

% the function and its derivative

f = @(x) x - tan(x);

df = @(x) 1 - sec(x).^2;

% loop over which one we are finding

for k=1:9 x = (2*k+1 - 0.01) * pi/2; % starting point just left of (odd)*pi/2

% loop to do Newton iteration

for j=1:10

x = x - f(x) / df(x);

end

roots = [roots x];

end

roots = roots’

residuals = abs(f(roots))

Add a comment
Know the answer?
Add Answer to:
question number 2 1. Write a computer program to solve the equation x = tan x...
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
  • please answer this question with python. Write a program to solve the quadratic equation ax^2 +...

    please answer this question with python. Write a program to solve the quadratic equation ax^2 + bx + c = 0 using the standard quadratic formula x = -b plusminus Squareroot b^2 - 4ac/2a or the alternative formula x = 2c/-b Squareroot b^2 - 4ac. Your program should accept values for the coefficients a, b, and c as input and produce the two roots of the equation as output. Your program should detect when the roots are imaginary, but need...

  • Find all solutions of the equation in the interval [0, 2π). tan"X-2 sec x =-1 write...

    Find all solutions of the equation in the interval [0, 2π). tan"X-2 sec x =-1 write your answer in radians in terms of π. If there is more than one solution, separate them with commas. Find all solutions of the equation in the interval [0, 2π). 2sin-10 Write your answer in radians in terms of t If there is more than one solution, separate them with commas.

  • For the equation y = -2 exp(3 - x) - 4 write a program to solve...

    For the equation y = -2 exp(3 - x) - 4 write a program to solve for the first positive root. Describe the error in your solution.

  • How to write a matlab program for the following question? Q: 1.Topic:"Automatic Quiz Grading" 2.T...

    how to write a matlab program for the following question? Q: 1.Topic:"Automatic Quiz Grading" 2.The concept is to calculate the student's score in the way of computer scoring. 3.Student's answer (file name: a2.dat) 4.Standard answer (file name: a1.dat) 5. The number of questions are 20 6. all pairs Get +1 point, deduct one option for 1 point 7.calculate the student's grade

  • c++ language TECH 1211 Computer Programming Name Test 2 Hands-On-Program B Spring 2020 Write a program...

    c++ language TECH 1211 Computer Programming Name Test 2 Hands-On-Program B Spring 2020 Write a program that uses the quadratic formula to solve quadratic equations. Background Given the format for a quadratic equations: aX? +BX+C =0 The coefficient of the X term is the number a. The coefficient of the X term is the number b. The value of c is any non-zero constant. These values can be positive, negative or zero. You can find the solution to this equation...

  • Using Python Version 1. Write a program that uses a "while" loop to print the first...

    Using Python Version 1. Write a program that uses a "while" loop to print the first 10 positive integers and to compute their sum. Print the sum after it is computed. Do the same with a "for" loop. Version 2. Write a program to approximate the square root of a number. Recall that the square root of a number x is a number r such that r*r = x. Newton discovered that if one initial estimate of r is z...

  • [1+1 Write a program to solve the equation y = sqrt(5 {x}^{5) + 3 {x}^{4} +...

    [1+1 Write a program to solve the equation y = sqrt(5 {x}^{5) + 3 {x}^{4} + 10). a) In the function, you should take the value of the integer from the user b) The value of x should be between 1 and 9. Make sure that the user has not entered a valid value. c) Calculate the value according to the formula and print it on the screen. d) The value of the output variable y should be printed only...

  • 1 2 NAME Q1. (30pts) Solve the quadratic equation z2-(3+3i)z +6+2i = 0 by realizing the...

    1 2 NAME Q1. (30pts) Solve the quadratic equation z2-(3+3i)z +6+2i = 0 by realizing the following plan: (i) find the discriminant A of the equation; (ii) write a program for a scientific calculator to obtain the polar form r(cos 0 + i sin 0) of A and the 'first' root + isin COS 2 of degree two of A; (iii) execute the program, fix the results, find another root A2 of A of degree two (before executing the program,...

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