Evaluate and Interpret a condition number for the following:
f(x)=sqrt(abs(x-1))+1 for x=1.00001
f(x)=e^-x doe x=10
f(x)=sin(x)/(1+cos(x)) for x=1.0001*pi
USE MATLAB
clc;
clear all;
format short
f=@(x)sqrt(abs(x-1))+1; %function
df=@(x)1/(sqrt(x-1)*2); %derivative of function
x=1.00001;
f(x)
df(x)
% Condition number
disp('Condition number')
k=x*df(x)/f(x)
%%%%%%%%% Answer
ans =
1.0032
ans =
158.1139
Condition number
k =
157.6170
>>
2)
clc;
clear all;
format short
f=@(x)exp(-x); %function
df=@(x)-exp(-x); %derivative of function
x=10;
f(x)
df(x)
% Condition number
disp('Condition number')
k=x*df(x)/f(x)
%%%%%% Answer
ns =
4.5400e-05
ans =
-4.5400e-05
Condition number
k =
-10
>>
3)
clc;
clear all;
format short G
f=@(x)sin(x)/(1+cos(x)) ; %function
df=@(x)1/(cos(x)+1); %derivative of function
x=1.0001*pi;
f(x)
df(x)
% Condition number
disp('Condition number')
k=x*df(x)/f(x)
%%%%%%%%%%%%%%%% Answer
ans =
-6366.2
ans =
2.0264e+07
Condition number
k =
-10001
>>
Get Answers For Free
Most questions answered within 1 hours.