3
$\begingroup$

I am trying to find out when: $$f(x,y,z,α,β,γ):= z\cos(β)\cos(γ)+y(\cos(γ)\sin(α)\sin(β)+\cos(α)\sin(γ))+x(−\cos(α)\cos(γ)\sin(β)+\sin(α)\sin(γ)),$$ where $α,β, \text{and } γ$ can be any value in $[-2\pi,2\pi]$ is positive.

But solving this is very difficult, and I don't know if it can be solved exactly in Mathematica without having more insights. (It comes from rotating the point $\{x,y,z\}$ using the RollPitchYawMatrix in Mathematica, and then taking the last coordinate.)

So, I thought about parametric plotting: $$\{x(−\cos(α)\cos(γ)\sin(β)+\sin(α)\sin(γ)), y(\cos(γ)\sin(α)\sin(β)+\cos(α)\sin(γ)), z\cos(β)\cos(γ)\},$$ while making the angles $α,β, \text{and } γ$ as RGBColors with $α$ being how red, $γ$ being how green, and $β$ being how blue with the opacity being 1 when $f()$ is positive, and 0 if it is non-positive. For points that can be represented by more than one way, the color would be the average of the colors that give that point. (For example gray is the average of black and white.)

The problem I have is that ParatmetricPlot3D in Mathematica is of the form:

ParametricPlot3D[{f[u, v], g[u, v], h[u, v]}, {u, u_min, u_max}, {v, v_min, v_max}]

But I ideally want something like:

ParametricPlot3D[{x*f[t, u, v], y*g[t,u, v], z*h[t,u, v]}, {x,x_min, x_max}, {y,y_min, y_max},{z,z_min, z_max}, {t, t_min, t_max}, {u, u_min, u_max}, {v, v_min, v_max}].

But that is not allowed.

I also started trying something like this:

ParametricPlot3D[
 {(-Cos[α] Cos[γ] Sin[β] + Sin[α] Sin[γ]),
  (Cos[γ] Sin[α] Sin[β] + Cos[α] Sin[γ]),
  Cos[β] Cos[γ]},
 {{α, -2 π, 2 π},
  {β, -2 π, 2 π},
  {γ, -2 π, 2 π}},
 ColorFunction -> Function[{x, y, z, α, β, γ},
   RGBColor[(α + 2 π)/(4 π),(γ + 2 π)/(4 π),(β + 2 π)/(4 π)]
  ],
 ColorFunctionScaling -> False
],

but I could not figure out how to actually fix it.

My thought is that for a fixed domain, the solution should appear to look like a 3D ribbon with thickness curved in a quasi-periodic way, with a periodic color scheme. But there is a good chance that I am wrong.

$\endgroup$
1
  • 2
    $\begingroup$ Your last code example will work if you change the ParametricPlot3D to ContourPlot3D. Also let's remove the x,y,z from the definition of the ColorFunction - these variables are not defined there. $\endgroup$
    – Rom38
    Oct 3, 2023 at 4:25

1 Answer 1

5
+150
$\begingroup$

Nothing fancy it is just a plane for particular values of $α, β, γ$. On one side of the plane the function is negative on the other positive and right at the plane it is zero.

Manipulate[
 ContourPlot3D[
  z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) == 0, {x, -2, 2}, {y, -2, 
   2}, {z, -2, 2}], {α, 0, 2 π}, {β, 0, 
  2 π}, {γ, 0, 2 π}]

enter image description here

Or you can depict it the other way around. Manipulate x,y,z and plot in in some region defined by α, β, γ.

Manipulate[
 ContourPlot3D[
  z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) == 0, {α, 0, 
   2 π}, {β, 0, 2 π}, {γ, 0, 2 π}], {x, -2, 
  2}, {y, -2, 2}, {z, -2, 2}]

enter image description here

Or if you want to see precisely where it is negative and where positive you could use RegionPlot3D instead.

Manipulate[
 RegionPlot3D[{z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) < 0, 
   z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) > 0}, {x, -2, 2}, {y, -2, 
   2}, {z, -2, 2}, PlotStyle -> {Automatic, Opacity[0.5]}], {α,
   0, 2 π}, {β, 0, 2 π}, {γ, 0, 2 π}]

enter image description here

Manipulate[
 RegionPlot3D[{z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) < 0, 
   z Cos[β] Cos[γ] + 
    y (Cos[γ] Sin[α] Sin[β] + 
       Cos[α] Sin[γ]) + 
    x (-Cos[α] Cos[γ] Sin[β] + 
       Sin[α] Sin[γ]) > 0}, {α, 0, 
   2 π}, {β, 0, 2 π}, {γ, 0, 2 π}, 
  PlotStyle -> {Automatic, Opacity[0.5]}], {x, -2, 2}, {y, -2, 
  2}, {z, -2, 2}]

enter image description here

$\endgroup$
5
  • $\begingroup$ Often not fancy works. But how can you visualize when the function is positive dependenton the 6 variables? Maybe I am overcomplicating it, but because the angles are so nonlinear, I don't think using Manipulate helps to visualize the entire positive solution, while showing which combinations of the 6 values do that. $\endgroup$
    – Teg Louis
    Oct 3, 2023 at 22:57
  • 1
    $\begingroup$ Function in 6 variables occupy 7 dimensional space, so it is not easy to visualize, if not impossible. I think the first visualization depict the situation very well. For any combination of angles there is always half of 3D space created by x,y,z where the function is positive and half space where it is negative. There is no combination of angles that would make the function positive for every combination of x,y,z. $\endgroup$ Oct 4, 2023 at 5:51
  • 1
    $\begingroup$ @Teg Louis: Maybe RegionPlot3D visualize it better, see update. In orange region it is negative in blue it is positive. The more distant from orange region the more positive it is. $\endgroup$ Oct 4, 2023 at 6:22
  • 1
    $\begingroup$ Your first RegionPlot3D has an error after the alpha, there is a bracket in the wrong place I believe. $\endgroup$
    – Teg Louis
    Oct 11, 2023 at 19:17
  • 1
    $\begingroup$ Yes, corrected. Thanks. $\endgroup$ Oct 11, 2023 at 19:30

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.