06-240/QuiltPlot: Difference between revisions
From Drorbn
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
{{06-240/Navigation}} |
{{06-240/Navigation}} |
||
{| align=center |
|||
|- align=center |
|||
|[[Image:06-240-QuiltBeforeMap.png|200px]] |
|||
|<math>\longrightarrow</math> |
|||
|[[Image:06-240-QuiltAfterMap.png|200px]] |
|||
|- align=center |
|||
|<math>z</math> |
|||
|<math>\mapsto</math> |
|||
|<math>z^2</math> |
|||
|} |
|||
Code in [http://www.wolfram.com Mathematica]: |
Code in [http://www.wolfram.com Mathematica]: |
||
| Line 35: | Line 46: | ||
QuiltPlot[{x^2-y^2, 2*x*y}, {x, -10, 10, 8}, {y, 5, 10, 8}] |
QuiltPlot[{x^2-y^2, 2*x*y}, {x, -10, 10, 8}, {y, 5, 10, 8}] |
||
</pre> |
</pre> |
||
Back to [[06-240/Linear Algebra - Why We Care]]. |
|||
Latest revision as of 10:25, 17 October 2006
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [math]\displaystyle{ \longrightarrow }[/math] | ||
| [math]\displaystyle{ z }[/math] | [math]\displaystyle{ \mapsto }[/math] | [math]\displaystyle{ z^2 }[/math] |
Code in Mathematica:
QuiltPlot[{f_,g_}, {x_, xmin_, xmax_, nx_}, {y_, ymin_, ymax_, ny_}] :=
Module[
{dx, dy, grid, ix, iy},
SeedRandom[1];
dx=(xmax-xmin)/nx;
dy=(ymax-ymin)/ny;
grid = Table[
{x -> xmin+ix*dx, y -> ymin+iy*dy},
{ix, 0, nx}, {iy, 0, ny}
];
grid = Map[({f, g} /. #)&, grid, {2}];
Show[
Graphics[Table[
{
RGBColor[Random[], Random[], Random[]],
Polygon[{
grid[[ix, iy]],
grid[[ix+1, iy]],
grid[[ix+1, iy+1]],
grid[[ix, iy+1]]
}]
},
{ix, nx}, {iy, ny}
]],
Frame -> True
]
]
QuiltPlot[{x, y}, {x, -10, 10, 8}, {y, 5, 10, 8}]
QuiltPlot[{x^2-y^2, 2*x*y}, {x, -10, 10, 8}, {y, 5, 10, 8}]
Back to 06-240/Linear Algebra - Why We Care.