I have to find the sum of the enclosed area between two functions that goes from 0 to 2pi:
f[x_]:=x-(1+3/2)Sin(2x);
g[x_]:=(x/2)-8Cos(3x-pi/19);
Plot[{f[x],g[x]},{x,0,2pi}, PlotLegends->"Expressions"]
I got the intersections by using NSolve:
{a,b,c,d,e,f}:=x/.NSolve[{f[x]==g[x]&&0<x<2pi},x,Reals]
But when I use ImplicitRegion and try to get the area between the two lines, I get nothing usefull for RegionUnion or RegionPlot. I do a ImplicitRegion between every intersection (0-a, a-b, b-c and so on to f-2pi) and then try to plot the Region.
r1=ImplicitRegion[g[x]<y&&f[x]>y,{{x,0,a},y}]
r2=ImplicitRegion[g[x]<y&&f[x]>y,{{x,a,b},y}]
Area@RegionUnion[r1,r2]
RegionPlot[{r1, r2}, PlotRange -> {{0, 2pi}, {-8, 10}}]
But Mathematica enters an infite loop which I have to abort. What is it that I'm missing?