1
$\begingroup$

This question already has an answer here:

I am trying to do a density plot of a function in polar coordinates. The function I am interested in study is
$\Lambda^4 (1 - Cos(\frac{r[t]}{f_r} - \frac{\theta[t]}{f_{\theta}})) + \frac{1}{2} m^2 r[t]^2$

but I don't know how to plot that onto a plane ($r[t]Cos(\theta[t])$, $r[t]Sin(\theta[t])$).

the parameters can be $ f_r = 10^{-3}, f_{\theta} = 10^{-1}, m = 10^{-4}, \Lambda = 10^{-3} $

Any suggestions?

$\endgroup$

marked as duplicate by J. M. will be back soon plotting Oct 8 '18 at 14:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Where did that function you are trying to plot come from? $\endgroup$ – J. M. will be back soon Oct 8 '18 at 13:51
  • $\begingroup$ An inflationary model $\endgroup$ – rob Oct 8 '18 at 13:54
  • $\begingroup$ You see, $\Lambda$, $m$, and $f$ are not defined in your post, and you did not clarify what those subscripts for $f$ are intended for. $\endgroup$ – J. M. will be back soon Oct 8 '18 at 14:00
  • $\begingroup$ They are just defined parameters $\endgroup$ – rob Oct 8 '18 at 14:01
  • $\begingroup$ @UlrichNeumann Even better would be to color the plot by height and pick a ViewPoint infinitely above: ParametricPlot3D[{r Cos[t], r Sin[t], f[r, t]}, {r, 0, R}, {t, 0, 2 Pi}, ColorFunction -> "Rainbow", ViewPoint -> {0, 0, Infinity}] $\endgroup$ – Michael E2 Oct 8 '18 at 14:10
3
$\begingroup$

One way:

f[r_, t_] := Cos[3 t] Sin[4 r]/(1 + r^2);
DensityPlot[
 f[Sqrt[x^2 + y^2], ArcTan[x, y]], {x, y} ∈ Disk[{0, 0}, 2], 
 Exclusions -> None, PlotPoints -> 50]

Mathematica graphics

Alternative way, based on a deleted comment by @UlrichNeumann:

ParametricPlot3D[{r Cos[t], r Sin[t], f[r, t]},
 {r, 0, 2}, {t, 0, 2 Pi},
 ColorFunction -> "Rainbow", ViewPoint -> {0, 0, Infinity}, 
 Lighting -> {{"Ambient", White}}, BoundaryStyle -> Black, 
 Axes -> {True, True, False}]

Mathematica graphics

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.