Help with root finding methods?
Afficher commentaires plus anciens
The sum of two numbers a and b is 21.2. If each number is added to its own square root (i.e. a + √ a), the product of the two sums is 170.73. Using either Newton’s method or the secant method, determine the two numbers using a tolerance of 10−4 Consider x0 = 0 and/or x1 = 1 as starting values. Hint: Set up as a system of two equations and two unknowns and reduce to one equation with one unknown.
I tried using this code but it gave me the same answer each time and one that doesn't fit the formula. Any suggestions? Thanks!
ff1=@(x) ((21.2-x)+sqrt(21.2-x)).*(x+sqrt(x))-170.73;
secantmethod(ff1,0,1,10.^(-4))
ff2=@(x) (x+sqrt(x)).*((21.2-x)+sqrt(21.2-x))-170.73;
secantmethod(ff2,0,1,10.^(-4))
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
