1
$\begingroup$

Consider the following crudely implemented function

f[\[Phi]1_, \[Phi]2_, \[Phi]3_] := 
 Module[{r, a1, a2, a3, a4, w1, w2, w3, w4, basis4D},
  r = {Cos[\[Phi]1], Sin[\[Phi]1] Cos[\[Phi]2], 
    Sin[\[Phi]1] Sin[\[Phi]2] Cos[\[Phi]3], 
    Sin[\[Phi]1] Sin[\[Phi]2] Sin[\[Phi]3]};
  r = r/Plus @@ r // N;
  
  a1 = {1, 0, 0, 0};
  a2 = {0, 1, 0, 0};
  a3 = {0, 0, 1, 0};
  a4 = {0, 0, 0, 1};
  
  w1 = Normalize[a1 - a2];
  w2 = Normalize[a1 - a3];
  w2 = Normalize[w2 - (w1 . w2) w1];
  w3 = Normalize[a1 - a4];
  w3 = Normalize[w3 - (w1 . w3) w1 - (w2 . w3) w2];
  w4 = Table[
     Sum[
      LeviCivitaTensor[4][[i, j, k, l]] w1[[j]] w2[[k]] w3[[l]], {j, 
       1, 4}, {k, 1, 4}, {l, 1, 4}], {i, 1, 4}] // Normalize;
  basis4D = {w1, w2, w3, w4};
  (r . # & /@ basis4D)[[1 ;; 3]]
  ]

Maps points $(\phi_1,\phi_2,\phi_3)$, $\phi_i\in[0,\frac{\pi}2]$, on a region of a 3-sphere (embedded in 4-dimensions) to points $(x,y,z)$ on a tetrahedron in 3D. And similarly

g[X_] := Module[{\[Phi]1, \[Phi]2, \[Phi]3, val, x, y, z},
  {\[Phi]1, \[Phi]2, \[Phi]3, val} = X;
  {x, y, z} = f[\[Phi]1, \[Phi]2, \[Phi]3];
  {x, y, z, val}
  ]

mapping $(\phi_1,\phi_2,\phi_3,val)$ to $(x,y,z,val)$. To see how points are mapped, for example see

f[#[[1]], #[[2]], #[[3]]] & /@ 
  N@Tuples[Range[0, \[Pi]/2, (\[Pi]/2)/8], 3] // ListPointPlot3D

Now, if I use this with ListDensityPlot3D it returns an empty plot. Say

data = Flatten[#, 2] &@
   Table[{x, y, z, x y z // N}, {z, 0, \[Pi]/2, \[Pi]/2/10}, {y, 
     0, \[Pi]/2, \[Pi]/2/10}, {x, 0, \[Pi]/2, \[Pi]/2/10}];
ListDensityPlot3D[data] # Works fine

dataTransformed = ParallelMap[g, data // N];
ListDensityPlot3D[dataTransformed] # Empty plot

Why is that the case? Is there a way to fix that? If I do the same in one lower dimensions, namely project some data on one quadrant of a 2-sphere to a 2-simplex (triangle) and use ListDensityPlot, then everything works fine.

$\endgroup$
2
  • $\begingroup$ Observation: data vs dataTransformed looks like this. $\endgroup$
    – Syed
    May 21, 2022 at 3:36
  • 4
    $\begingroup$ I’m voting to close this question because the OP has not provided any feedback for an extended period of time. $\endgroup$
    – Syed
    Oct 12, 2023 at 10:04

0

Browse other questions tagged or ask your own question.