create a Matlab code that solves the next equation f(x) = x^2-6 using Halley's method where the initial guess = 1. You should ask the user to enter the maximum number of iterations with an error that doesn't exceed the limit of 0.00000001 The code should print an error message if the solution does not converge within the given number of iterations.
%Halley's Method %Halley's Method involves: g(x) = x - f(x)/f'(x)*[1 - f(x)f''(x)/(2(f'(x))^2) % Implementation of Halley's method to solve the equation f(x) = x^2 - 6. i = 1; % initializing i value to use in the for loop as a starting point for iterations p0 = 1; %initial conditions N = input('input the maximum number of iterations ); %maximum number of iterations error = 0.00000001; %precision required syms 'x' % define 'x' as a variable to be used in the function f(x) = x^2 - 6; %the function we are root finding. dx = diff(f); %first derivatives of f(x) ddx = diff(dx); % second derivatives of f(x) % now we will construct the loop with The maximum number of iterations N = 100 while i <= N p = p0 - (f(p0)/dx(p0))*(1 - (f(p0)*ddx(p0)/dx(p0)^2))^(-1); %Implementation of Halley's Method if (abs(p - p0)/abs(p)) < error %stopping criterion when difference between iterations is below tolerance fprintf('Solution is %f \n', double(p)) return end i = i + 1; % increasing the value of i by 1 in each time the loop runs p0 = p; %update (or assign) value of p0 to take the previous value of p end fprintf('Solution did not converge within %d iterations at a required precision of %d \n', N, error) %error message for non-convergence within N iterations end
Given a = 161 , b = 28 . using the the concept of Extended Euclidean Algorithm, find gcd (a,b) and the values of s and t.
161 = 28(5) + 21 28 = 21(1) + 7 21 = 7(3) + 0 ( we neglect the equation that contains 0 so that the reminder of the last equation becomes the value of gcd we want to determine) So gcd(161,28) = 7 then we construct a new system of equations from the previous ones by changing the equal sing (=) to minus sign (-) , and we change plus sign (+) to equal sign (=) so, we get : 161 - 28(5) = 21 28 - 21(1) = 7 we construct the equation 161s + 28t = gcd(161+28) [Extended Euclidean Algorithm] 161s + 28t = 7 then we choose an equation from above that contains the same value of gcd (which is 7 ) as a reminder in the right side. That one will be 28 - 21(1) = 7 28 - 21(1) = 7 we substitute of 21 on this equation from the previous one which is 21= 161 -28(5) so it becomes : 28 - (161 - 28(5)) (1) = 7 then we combine like terms that contain 28 so: 28 (1) + 28 (5) - 161 (1) = 7 re arrange it so that it is on the same format of the equation of s and t so: 161 (-1) + 28 (6) = 7 161 s + 28 t = 7 and we compare the 2 equations together to find the s and t values So, s = -1, t =6
assume that you are on the admissions board at a highly selective well known University (ILU). You are entitled to recommend students for admission to ILU. You have to identify students who have the greatest potential to excel at ILU and granting total tuition-remission scholarships to those students. Both decisions are made depending on University Aptitude Test (UAT) scores of the students. The admissions board has decided that it will offer admission to students who can probably earn a first-year GPA of at least 3.00. “Free-ride” scholarships will be granted to students whose predicted first-year GPA is 3.80 or better. You have four incoming freshmen to make scholarship decisions about. Incoming Students UAT Score June 2 Marcos 18 Reginald 8 Sara 19 The correlation coefficient for the relationship between UAT and GPA is .68 ( p value = .006). This correlation is (significant? non-significant? unknown?).
Since p-value that is related to correlation coefficient is less than 0.05 so it is significant. This correlation is significant. ـــــــــــــــــــــــــــــــــــــــــــــــــ June's predicted 1st year GPA is Y’ = 2.345 + .08 *2 = 2.505 So required predicted score is 2.51. ـــــــــــــــــــــــــــــــــــــــــــــــــ Marcos's predicted 1st year GPA is Y’ = 2.345 + .08 *18 = 3.785 So required predicted score is 3.79. ـــــــــــــــــــــــــــــــــــــــــــــــــ Reginald's predicted 1st year GPA is Y’ = 2.345 + .08 *8 = 2.985 So required predicted score is 2.99. ـــــــــــــــــــــــــــــــــــــــــــــــــ Sara's predicted 1st year GPA is Y’ = 2.345 + .08 *19 = 3.865 So required predicted score is 3.87.