The difference quotient formula for the first and second derivatives are given r
ID: 2863884 • Letter: T
Question
The difference quotient formula for the first and second derivatives are given respectively by difquo = f (x + h) - f(x)/h; difdifquo = f (x+h) - 2f (x)+ f (x -h) Using the difference quotient formula for the first derivative (difquo), and for the second derivative (difdifquo) answer the questions below Given f (x) = x In (x) Create a function m - file for f (x). For h = 0.001, make a graph of f (x), difquo and difdifquo on the same axes over the interval [1/2, 5]. write the commands, used (show the graph to the instructor.) Generate different values of h to find a better approximation for the first derivative of the function using the difquo formula at x = 1. What is the value of difquo at that point? Find the equation of the tangent line to f(x) at x = 1 using h - 0.0001, and write out the equation in the form y = mx + b.Explanation / Answer
MATLAB program
clc
clear all
h=0.001;
%Evaluating function f(x)=xln(x)
x = 0.5:h:5
fx = x.*log(x);
plot(x,fx)
%Evaluating diffqo function
% diffqo=((x+h)ln(x+h)-xln(x))/h
x = 0.5:h:5
diffqo=(1/h)*(((x+h).*log(x+h))-(x.*log(x)));
hold on
plot(x,diffqo,'r')
%Evaluating difdiffqo function
x = 0.5:h:5
fxh = (x+h).*log(x+h);
fx=x.*log(x);
fxmh = (x-h).*log(x-h);
difdiffqo = (fxh-2*fx+fxmh)/h
hold on
plot(x,difdiffqo,'k')