# Question:Working with 3D Plots (Product Balls)

## Question:Working with 3D Plots (Product Balls)

Maple
A colleague recently approached me with this problem: Given two sets S1 and S2 in R^3, define the "product ball" of S1 and S2 to be the set of all points in R^3 obtained as the componentwise product of a point in S1 and a point in S2. That is, PB(S1,S2) = { (a*x,b*y,c*z) : (a,b,c) in S1 and (x,y,z) in S2 }. Can Maple help me to visualize this set? For a concrete example, let S1 = { (x,y,z) : max( abs(z), abs(x)+abs(y) ) = 1 } and S2 = { (x,y,z) : max( abs(y), abs(x)+abs(z) ) = 1 } In this case it can be shown that PB(S1,S2) consists of the following eight parametric surfaces: (x,y,z) = ( s*t, 1-s, 1-t), s=0..1, t=0..1 (x,y,z) = (-s*t, 1-s, 1-t), s=0..1, t=0..1 (x,y,z) = ( s*t,-1+s, 1-t), s=0..1, t=0..1 (x,y,z) = (-s*t,-1+s, 1-t), s=0..1, t=0..1 (x,y,z) = ( s*t, 1-s,-1+t), s=0..1, t=0..1 (x,y,z) = (-s*t, 1-s,-1+t), s=0..1, t=0..1 (x,y,z) = ( s*t,-1+s,-1+t), s=0..1, t=0..1 (x,y,z) = (-s*t,-1+s,-1+t), s=0..1, t=0..1 The 4 pieces with z>0 can be created and displayed as follows:
```with( plots ):
P1 := plot3d( [s*t,1-s,1-t], s=0..1, t=0..1,
style=patchnogrid, transparency=0.3 ):
P2 := plot3d( [-s*t,1-s,1-t], s=0..1, t=0..1,
style=patchnogrid, transparency=0.3 ):
P3 := plot3d( [s*t,-(1-s),1-t], s=0..1, t=0..1,
style=patch, transparency=0.5 ):
P4 := plot3d( [-s*t,-(1-s),1-t], s=0..1, t=0..1,
style=patch, transparency=0.5 ):
display( [P1,P2,P3,P4],
view=[-1.1..1.1,-1.1..1.1,-1.1..1.1],
labels=[x,y,z], axes=normal, transparency=0.7 );
```
Now for my question. How can a similar plot be obtained working only with the definitions of S1, S2, and PB(S1,S2)? Here is my best attempt, so far. We begin be plotting the sets S1 and S2. This is done with implicitplot3d, with appropriate options:
```S1 := X -> max( abs(X[3]), abs(X[1])+abs(X[2]) );
S2 := X -> max( abs(X[2]), abs(X[1])+abs(X[3]) );

N := 15:
Pargs := NULL,
x=0..1, y=0..1, z=0..1,
grid=[N,N,N],
style=patchnogrid,
axes=boxed,
transparency=0.7,
NULL;
PP1 := implicitplot3d( S1([x,y,z])=1, Pargs, color=red ):
PP2 := implicitplot3d( S2([x,y,z])=1, Pargs, color=cyan ):
display( [PP1,PP2], axes=boxed );
```
To construct the product ball, extract the points from these two plots:
```# Extract the points on the first surface
M1 := op( [1,1], PP1 ):
GRID1 := [ seq( seq( seq( M1[i,j,k,1..4], k=1..N ), j=1..N ), i=1..N ) ]:
PTS1 := select( v->evalb( abs(v[4])```
and then construct the points on the product ball:
```PTS12 := zip( (v,w)->[v[1]*w[1],v[2]*w[2],v[3]*w[3]], PTS1, PTS2 ):
```
But now all I can do with this is create a pointplot(3d):
```PP12 := pointplot3d( PTS12, axes=boxed, connect=false ):
display( [PP1,PP2,PP12] );
```
I would really like to be able to see this as a surface, possibly even with contours. (What we are really interested in in this case is the fact that the product ball is not convex.) Does anyone have any suggestions on how to improve the construction or visualization of the product ball? A worksheet containing the work discussed above, both parametric and constructive, can be found at: Download 178_ProductBalls5.mw
View file details Thanks in advance, Doug
﻿