Say I have a function $y=x^2 + 2x + 1$ and I want to plot it over the cross sectional area of a hollow cylinder between $x=1$ and $x=2$ in Mathematica. See the attached example below. How do you go about making figures of this type in Mathematica?
2 Answers
$\begingroup$
$\endgroup$
1
- Maybe you want a
DensityPlot
in polar coordinates with functionf[r_, θ_] := r^2 + 2 r + 1;
. - See also https://mathematica.stackexchange.com/a/300171/72111
Clear["Global`*"];
f[r_, θ_] := r^2 + 2 r + 1;
DensityPlot[
f[r, θ] // Evaluate, {r, 1, 2}, {θ, 0, π/2},
PlotRange -> All,
DisplayFunction ->
ReplaceAll[{r_Real, t_Real} :> {r*Cos[t], r*Sin[t]}],
ColorFunction -> Hue]
$\begingroup$
$\endgroup$
Your equation makes no sense. But the closest thing that does make sense is:
RevolutionPlot3D[r^2 + 2 r + 1,
{r, 1, 2},
{\[Theta], 0, \[Pi]/2}.
ColorFunction->"Rainbow"]
x,y
andθ
? $\endgroup$