1) Calculate the following for the function f (x) = e-3x - 2x
a. Calculate the derivative of the function by hand. Write a MATLAB function that calculates the derivative of this function and calculate the derivative at x = 0.5.
b. Develop an M- to evaluate the centered finite-difference approximations, at x = 0.5. Assume that dx = 0.1.
c. Repeat part (b) for the second-order forward and backward differences. Again Assume that dx = 0.1.
d. Using the results obtained in parts b and c, calculate the percentage error between the actual value and the the results of (b) and (c).
Use the following formulas:
Centered diff. df/dx=(f(i+1)-f(i-1))/2dx
Fwd. diff. df/dx=(-f(i+2)+4f(i+1)-3f(i))/2dx
Bkwd. diff. df/dx=(3f(i)-4f(i-1)+f(i-2))/2dx
2) a) Use the three-point Gauss-Legendre formula to evaluate the following function between 0 and 0.8
f (x) = 3x + 5x2
Remember that you have to make a change of variable to make the integration between -1 and 1. Do all your calculations in MAMAS.
b) Calculate the value of the integral using a MATLAB built in function of your choosing.
3) Use any Matlab built-in function to solve the following differential equation in the range oft = 0 to 10 and plot the solution.
y' = 4e0.8t - 5y, y(0) = 2.