b] \text { is given by } \int_{a}^{b}|f(x)-g(x)| \mathrm{d} x . \text { If } there are subintervals where f > g and others where g > f on [a, b] , evaluating this integral analytically requires one to obtain the locations where f and g cross before integrating either (f- g) or (g – f) respectively on each sub interval between the crossings, since integrals involving the absolute value function are difficult or impossible to evaluate in most cases. This issue can be avoided by instead evaluating the original integral numerically. Follow the steps below to compute the area between the curves f(x) = x^3 - 3x² + 2 and g(x) = cos(x²) (shown above) on the interval [0,3]. 1. Define the anonymous function F corresponding to |ƒ(x) – g(x)I. Make sure that you use element-wise operators when defining F. 2. Use the integral function to numerically integrate F from 0 to 3. Store the result in the variable A.
Fig: 1
Fig: 2
Fig: 3
Fig: 4
Fig: 5
Fig: 6
Fig: 7