Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Color grid with holes in it, to visualize overlapping mappings.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116617] Color grid with holes in it, to visualize overlapping mappings.
  • From: "Christopher O. Young" <cy56 at comcast.net>
  • Date: Mon, 21 Feb 2011 19:30:42 -0500 (EST)
  • References: <ijqqbj$ap3$1@smc.vnet.net>

It definitely looks like ParametricPlot[ ] and its mesh options are the
fastest way to put up a grid that can be transformed (via the u and v
arguments to ParametricPlot).

Below, for readability, I use a matrix form of the transformation (can
usually be done even for non-linear transformations) and then use Flatten[ ]
so it will end up as a simple list.

colorGrid[T_, n_, a_, b_, c_, d_, opts___] :=

   ParametricPlot[
       T//Flatten, {v, c, d}, {u, a, b},
       Mesh -> {n - 1, n - 1},
       ColorFunction ->
 
        Function[{x, y, u, v}, Hue[0.4 v, 0.1 + 0.9 u, 1]],
    
  MeshFunctions -> {#3 &, #4 &},
    
  MeshShading -> {{None, Automatic}, {Automatic, None}},
    
  opts
  ]


The MeshShading options above punch holes in the grid, so we can see more
clearly how surfaces overlap in the case of overlapping mappings.

There are examples of this with real powers of complex numbers at

http://home.comcast.net/~cy56/PowersOfZ.m
http://home.comcast.net/~cy56/PowersOfZ.nb
http://home.comcast.net/~cy56/PowersOfZ.png

Chris Young
IntuMath.org



On 2/20/11 5:28 AM, in article ijqqbj$ap3$1 at smc.vnet.net, "Heike Gramberg"
<heike.gramberg at gmail.com> wrote:

> I'm not entirely sure how you want to use your function, but if you're
> interested in drawing the image of a rectangular grid after a 2D
> transformation you could do something like this:
> 
> mesh[fx_, fy_, opts___] :=
>  ParametricPlot[{fx[x, y], fy[x, y]}, {x, 0, 1}, {y, 0, 1},
>   Mesh -> 9,
>   MeshShading ->
>    Table[Hue[xi, (1 - yi), 1], {yi, Range[0, 1, 1/10]}, {xi,
>      Range[0, 1, 1/10]}], opts]
> 
> This would draw the image of the square 0<x,y<1 with a 10x10 coloured grid
> under the mapping {x,y}->{fx[x,y],fy[x,y]}.
> 
> Heike.



  • Prev by Date: Re: Diagonalizing large sparse matrices
  • Next by Date: Re: Misprint in the Documentation?
  • Previous by thread: Re: Rational[a,b] vs Rational[1,2]
  • Next by thread: Re: NDSolve Unable to find initial conditions that