# Question about finding the area

Here is a link to my previous question Question about plotting a curve and tangent lines

I want to know how can the area be found between the curve and tangent line for between Point Fun1 and Fun2.This is what I did but im not sure its correct or not. Do I have to use piecewise integration?

    Clear[f, x, g]
f[x_] = x^3
g = f[1.2] + f'[1.2] (x - 1.2)
Plot[{f[x], g}, {x, -5, 5}, PlotRange -> 20]
NIntegrate[f[x], {x, -2.4, 1.4}]
NIntegrate[f[x], {x, -2.4, 4.8}]


I also want to know how can I make the Manipulate function work for moving the point Fun1 to 15 positions in the interval[-5,0). I also want to learn how can I use the Manipulate function to update the drawing each time the points move(the drawing shows the tangents the intersection points)

    Manipulate[
Plot[{f[x],l[x]}, {t, -x, x}, Filling -> Axis,
PlotRange -> {{-5, 10}, {-5, 10}}, N[Erf[x]]], {1.3, 0.5}]], {x,
0.0001, 3}]


## 1 Answer

ClearAll[f, t]
f[x_] := x^3
t[x0_][x_] := f[x0] + f'[x0] (x - x0)

With[{x0 = 2}, Plot[{f@x, t[x0]@x, ConditionalExpression[t[x0]@x, x <= x0 ]}, {x, -5, 5},
PlotRange -> {{-5, 5}, {-80, 80}},
Filling -> {1 -> {{3}, {None, LightBlue}}},
PlotStyle -> {Automatic, Automatic, None},
ImageSize -> Large,
MeshFunctions -> {# &, f@# - t[x0]@# &},  Mesh -> {{x0}, {0}},
MeshStyle -> Directive[PointSize@Large, Red],
DisplayFunction -> (Show[#,
Epilog -> First@Cases[Normal@#,
p_Polygon :> Text[Style[ Column[{"area:", Area[p]}, Alignment -> Center],
14], RegionCentroid[p]], All]] &)]] Manipulate[Plot[{f@x, t[x0]@x, ConditionalExpression[t[x0]@x, -8 < x <= x0 ]},
{x, -8, 5},
PlotRange -> {{-8, 8}, {-220, 70}},
Filling -> {1 -> {{3}, {None, LightBlue}}},
PlotStyle -> {Automatic, Automatic, None},
ImageSize -> Large,
MeshFunctions -> {# &, f@# - t[x0]@# &},
Mesh -> {{x0}, {0}},
MeshStyle -> Directive[PointSize[Large], Red],
DisplayFunction -> (Show[# ,
Epilog -> {Text[Style[Round[#, .1], 16, Black], #, {-1, 3/2}] & /@
Cases[Normal@#, Point[x_] :> x, All][[;; 2]]},
PlotLabel -> Style[PromptForm["shaded area",
First @ Cases[Normal@#, p_Polygon :> Area[p], All]], 20]] &)],
{{x0, 2}, 0, 3, .1}] 