Question

Find the centroid of the region bounded by y=(e^(2(x^4)+x))and y=(e^(-(x^2)))+1.

Define Functions & Sketch Region:

f[x_]=Exp[2x^4+x]
g[x_]=Exp[-x^2]+1
region=RegionPlot[f[x]≤y≤g[x],{x,-1,1},{y,0,3}];
plot1=Plot[{f[x],g[x]},{x,-1,1},AxesLabel->{"x","y"},BaseStyle->20];
p1=Show[plot1,region,PlotRange->{{-1,1},{0,2}},AspectRatio->1,AxesOrigin->{0,0}]

Try to Find Points of Intersection:

NSolve[f[x]==g[x],x]

We can use the command FindRoot.This essentially implements Newton's Method for you.

Initialize the root finding process by choosing a value close to the root, which we can get from the graph above:

FindRoot[f[x]==g[x],{x,-1}]
FindRoot[f[x]==g[x],{x,0.5}]

These are the a and b in the integrals we need to work out.

a=-0.8916719647508025`
b=0.4793065148539439`

Find the area under the curve:

area=Integrate[(g[x]-f[x]),{x,a,b}]

Use Trapezoidal Rule: Note that the function the trapezoidal rule works on is ff[x], since f(x) is already used for something else! I am using SetPrecision to get 10 decimals of output. We will also use the set-delayed := to get around any unwanted early evaluation for any previously defined functions ff[x].

T[n_,a_,b_]:= SetPrecision[(b-a)/(2n) ( ff[a]+ff[b]+2Sum[ff[a+(b-a)/n*i],{i,1,n-1}]),10]

Use the trapezoidal rule to do our integral:

ff[x_]=g[x]-f[x]
Table[{n,T[n,a,b]} ,{n,1000,2000,100}]//TableForm

area=1.1410535

Find Moment about y-axis:

We will again need to use a numerical integration. From results above, it looks like if we use n=2000 we should get at least four decimals of accuracy.

ff[x_]=x(g[x]-f[x])
My=T[2000,a,b] 
xbar=My/area

Find Moment about x-axis:

ff[x_]=1/2(g[x]^2-f[x]^2)
Mx=T[2000,a,b] 
ybar=Mx/area

Check if Solution Makes Sense:

The aspect ratio has to be set correctly if we want to visually check our answer.

Show[p1,Graphics[Disk[{xbar,ybar},0.05]],PlotRange->{{-1,1},{0,2}},AspectRatio->1,AxesOrigin->{0,0}]

Looks pretty good!