Skip to main content
deleted 9 characters in body
Source Link
swish
  • 8.1k
  • 1
  • 30
  • 50

More generalized version:

 newRegionPlot3D[
   expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] := 
 Module[{x, y, z, newExpr, xyz}, 
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 rnewRegionPlot3D[r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]
 
newRegionPlot3D[
 ronewRegionPlot3D[ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]

enter image description here

More generalized version:

newRegionPlot3D[
  expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] :=
 Module[{newExpr, xyz},
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]
 
newRegionPlot3D[
 ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]

More generalized version:

 newRegionPlot3D[
   expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, tr_, opts___] := 
 Module[{x, y, z, newExpr, xyz}, 
  newExpr = TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, w}] & /@ xyz;
  {xmin, ymin, zmin} = NMinValue[{#, umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
]

Some examples:

newRegionPlot3D[r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]
newRegionPlot3D[ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]

enter image description here

deleted 9 characters in body
Source Link
swish
  • 8.1k
  • 1
  • 30
  • 50

More generalized version:

newRegionPlot3D[
  expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] :=
 Module[{x, y, z, newExpr, xyz},
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]

newRegionPlot3D[
 ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]

More generalized version:

newRegionPlot3D[
  expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] :=
 Module[{x, y, z, newExpr, xyz},
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]

newRegionPlot3D[
 ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]

More generalized version:

newRegionPlot3D[
  expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] :=
 Module[{newExpr, xyz},
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]

newRegionPlot3D[
 ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]
Source Link
swish
  • 8.1k
  • 1
  • 30
  • 50

More generalized version:

newRegionPlot3D[
  expr_, {u_, umin_, umax_}, {v_, vmin_, vmax_}, {w_, wmin_, wmax_}, 
  tr_, opts___] :=
 Module[{x, y, z, newExpr, xyz},
  newExpr = 
   TransformedField[tr -> "Cartesian", expr, {u, v, w} -> {x, y, z}];
  xyz = CoordinateTransform[tr -> "Cartesian", {u, v, w}];
  {xmax, ymax, zmax} = 
   NMaxValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  {xmin, ymin, zmin} = 
   NMinValue[{#, 
       umin < u < umax && vmin < v < vmax && wmin < w < wmax}, {u, v, 
       w}] & /@ xyz;
  RegionPlot3D[
   newExpr, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}, opts]
  ]

Some examples:

newRegionPlot3D[
 r < 1, {r, 0, 1}, {phi, 0, 2 Pi}, {th, 0, Pi}, "Spherical"]

newRegionPlot3D[
 ro < 1, {ro, 0, 1}, {phi, 0, 2 Pi}, {z, 0, 1}, "Cylindrical"]