In: Advanced Math
Given the function f(x) on the right solve the following root finding questions: a) Find a positive root (x > 0) of f(x) using the Bisection Method
. b) Find a negative root (x < 0) of f(x) using the Bisection Method.
c) Find a positive root (x > 0) of f(x) using the False Position Method.
d) Find a negative root (x < 0) of f(x) using the False Position Method. Find your initial Bracket via Trial-and-Error. Use | fM | < 0.0001 as the Stopping Criteria. Calculate and present all quantities with at least 4 decimal digits. Examine function f(x) whose plot given below. Major grid lines correspond to whole units and minor grid lines correspond to quarter units. Let f'(x) be the derivative of f(x) and F(x) be the indefinite integral of f(x).
f(x) = 0.5*x² + 10*x - 50 / x² - x + 10
Part-a
Code:
clc;
a=1;
b=2;
k=0;
while k==0
c=(a+b)/2;
val= 0.5*c*c + 10*c - 50/(c*c) - c +10;
if val>0
b=c;
else
a=c;
end
if abs(val)<0.00001
k=1;
end
end
fprintf('Positive root (Bisection Method) = %0.4f',c);
Output:
Positive root (Bisection Method) = 1.4426
Part-b
Code:
clc;
a=-16.5;
b=-17;
k=0;
while k==0
c=(a+b)/2;
val= 0.5*c*c + 10*c - 50/(c*c) - c +10;
if val>0
b=c;
else
a=c;
end
if abs(val)<0.00001
k=1;
end
end
fprintf('Negative root (Bisection Method) = %0.4f',c);
Output:
Negative root (Bisection Method) = -16.8328
Part-c
Code:
clc;
x1=1;
x2=2;
k=0;
while k==0
y1= 0.5*x1*x1 + 10*x1 - 50/(x1*x1) - x1 +10;
y2= 0.5*x2*x2 + 10*x2 - 50/(x2*x2) - x2 +10;
x3=x1 - ((x2-x1)*y1)/(y2-y1);
val= 0.5*x3*x3 + 10*x3 - 50/(x3*x3) - x3 +10;
if val>0
x2=x3;
else
x1=x3;
end
if abs(val)<0.00001
k=1;
end
end
fprintf('Positive root (False Position Method) = %0.4f',x3);
Output:
Positive root (False Position Method) = 1.4426
Part-d
Code:
clc;
x1=-16.5;
x2=-17;
k=0;
while k==0
y1= 0.5*x1*x1 + 10*x1 - 50/(x1*x1) - x1 +10;
y2= 0.5*x2*x2 + 10*x2 - 50/(x2*x2) - x2 +10;
x3=x1 - ((x2-x1)*y1)/(y2-y1);
val= 0.5*x3*x3 + 10*x3 - 50/(x3*x3) - x3 +10;
if val>0
x2=x3;
else
x1=x3;
end
if abs(val)<0.00001
k=1;
end
end
fprintf('Negative root (False Position Method) = %0.4f',x3);
Output:
Negative root (False Position Method) = -16.8328