00:01
So, in this question, they are presenting two different problems.
00:03
So, let's tackle one by one.
00:05
So, the problem one is a finite difference approximation.
00:09
So, first a part is calculating the exact derivative at x is equal to 2 for fx is equal to e to the power minus 2x minus x.
00:18
To find the derivative f dash x, you need to differentiate fx with respect to x.
00:23
So, f dash x is equal to minus 2 e to the power minus 2x minus 1.
00:32
So, now evaluate this at x is equal to 2.
00:36
So, f dash 2 is equal to minus 2 e to the power minus 2x minus minus 2 e to the power minus 4 minus 1.
00:46
Now, coming to the b part of this question, here we have to developing a m file function for centered file difference approximation.
00:54
So, code for this is function df dx centered difference x h df dx is equal to f x plus h minus f of x minus h divided by 2 multiplied by h and result function result is equal to fx result is equal to x minus 2 multiplied by x minus x and.
01:17
Now, after that you can use this function to calculate the centered finite difference at different values of x and h...