1
$\begingroup$

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

$\endgroup$
4
  • 3
    $\begingroup$ We need three variables to plot such figure, not only two variables. $\endgroup$
    – cvgmt
    Commented Mar 11 at 23:31
  • $\begingroup$ $\theta \in {0,\pi/2}$ $\endgroup$
    – Engineer
    Commented Mar 11 at 23:59
  • 2
    $\begingroup$ What are the relation between x,y and θ? $\endgroup$
    – cvgmt
    Commented Mar 12 at 0:08
  • $\begingroup$ Your "equation" makes no sense. $\endgroup$ Commented Mar 12 at 1:10

2 Answers 2

2
$\begingroup$
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

$\endgroup$
1
  • $\begingroup$ Thank you so much! $\endgroup$
    – Engineer
    Commented Mar 18 at 16:10
1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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