1

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? enter image description here

Engineer
  • 119
  • 3

2 Answers2

2
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]

enter image description here

cvgmt
  • 72,231
  • 4
  • 75
  • 133
1

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"]

enter image description here

David G. Stork
  • 41,180
  • 3
  • 34
  • 96