# Maple visualization of a function from R^2 to R^2 # (note: the 4th dimension is accomplished by color). with(plots): D2mapD2 := proc(lin1, lin2, plotpoints) # lin1 is a*s+b*t+c, s=0..1, t=0..1, is the height # lin2 is aa*s+bb*t+cc, s=0..1, t=0..1, is the color # (note: the HUE values vary only in the range -1..1; see piechart below) # plotpoints is the grid division along both s and t axis local plot, i, j; plot :=[seq( seq(# plot one patch polygonplot3d([subs({s=1/plotpoints*i, t=1/plotpoints*j}, [s,t,lin1]), subs({s=1/plotpoints*(i+1), t=1/plotpoints*j}, [s,t,lin1]), subs({s=1/plotpoints*(i+1), t=1/plotpoints*(j+1)}, [s,t,lin1]), subs({s=1/plotpoints*i, t=1/plotpoints*(j+1)}, [s,t,lin1])], color = COLOR(HUE, subs({s=1/plotpoints*i, t=1/plotpoints*j}, lin2)) ), i=0..plotpoints-1), j=0..plotpoints-1)]; end; display(D2mapD2(s-t, s+t-1/2, 10), axes=BOXED); piechart := proc(sectors) # sectors is the number of different sectors plotted local plot, i; plot := seq( # sequence of color plots plots[polygonplot]([[0,0],# first point of triangle # second point of triangle [cos(2*Pi*i/sectors),sin(2*Pi*i/sectors)], # third point of triangle [cos(2*Pi*(i+1)/sectors), sin(2*Pi*(i+1)/sectors)] ], color=COLOR(HUE,i/sectors) ), # finishes a single plot i=0..(sectors-1) # range of sequence ); plots[display]([plot]); end; # piechart piechart(40);