In this lab you will explore how Mathematica can be used to work with polar functions
To graph function given in polar form we will need to load a graphics package into Mathematica first:
<<Graphics`Graphics`You will need to type this in exactly as shown. (Note the use of the single left quote mark.)
Now we can use the PolarPlot command to graph polar functions. For example the function can be graphed as follows:
r[t_] = 2+3 Sin[t] p1=PolarPlot[r[t],{t,0,2 Pi}]and can be graphed in Mathematica by
r2[t_]=2 Cos[t] p2=PolarPlot[r2[t],{t,-Pi/2,Pi/2}]We can overlay these two graphs using the Show command:
Show[p1,p2,PlotRange->{{-1,3},{-2,2}}]where we use the PlotRange command to only display the part of the graphs in the region and .
From these two graphs, there appears to be a point of intersection at , r=2, another at the origin and a third at about . We could try and use the Solve command to find simultaneous solutions, but since this involves solving a transcendental equation of , Mathematica won't be able to do it. Instead we can use the FindRoot command:
FindRoot[r[t]-r2[t]==0,{t,0}]The FindRoot command expects an equation, an independent variable of the equation and a initial guess (like in Newton's Method). Try changing the initial guess to find the other points of intersection.
The basic formulas for finding the center of mass are
where . We could use these formulas and the change of variable formulas to calculate centers of mass given polar functions. For example: find the center of mass of the thin plate inside the graph of and outside the circle if the density function is given by . First a picture:
p3=PolarPlot[{1,1+Cos[t]},{t,0,2 Pi}]so the region we want is , where . To solve this problem in Mathematica we first need to tell Mathematica the change of variable formulas:
x = r Cos[t] y = r Sin[t]where we will use t instead of . We now just have to type in the basic center of mass integrals:
density = x^2 dmp = density r mass = Integrate[Integrate[dmp,{r,1,1+Cos[t]}],{t,-Pi/2,Pi/2}] momentx = Integrate[Integrate[y dmp,{r,1,1+Cos[t]}],{t,-Pi/2,Pi/2}] momenty = Integrate[Integrate[x dmp,{r,1,1+Cos[t]}],{t,-Pi/2,Pi/2}] xbar = Simplify[momenty/mass] ybar = Simplify[momentx/mass]Notice that we only need to give it the correct limits of integration in polar form. dmp is the incremental mass in polar coordinates, where the r comes from .
Use the above to find the center of mass of the thin ring, , if the density function is . You should only have to change the limits of integration and density.