MathGroup Archive 2001

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

Search the Archive

Re: Questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27288] Re: Questions
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 17 Feb 2001 03:31:08 -0500 (EST)
  • References: <96iq59$d7v@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Tony,
Mathematica can do all of these things, with a little programming.
Here are some suggestions.

Trans, below transforms a function that maps from R2 into  R2 into one that
goes inside objects and acts appropriately on Points, Lines and Polygons.
One issue whether, as here you regard polyagons as rigid or as bendable --
in the latter case we have to replace lines by fine segmets, replace
polygons by polygons with disected sides and circles by lines and disks by
polygons.

The following works also in 3D.

Please note that the function from R2 to R2 defined list to list :
f[{x,y}] = , not f[x,y] =.


Trans[f_][ a:(Polygon|Line)[_]]  :=Map[f,a ,{2}];

Trans[f_][ a_Point]  :=Map[f,a,{1}]

Trans[f_][x_]:=
  x/.a:(Polygon|Line|Point)[_]:>Trans[f][a]

Check the composition rules:

Trans[g][Trans[f][Polygon[{{0,0},{1,0},{1,1}}]]]

        Polygon[{g[f[{0,0}]],g[f[{1,0}]],g[f[{1,1}]]}]

Trans[Composition[g,f]][Polygon[{{0,0},{1,0},{1,1}}]]

        Polygon[{g[f[{0,0}]],g[f[{1,0}]],g[f[{1,1}]]}]


Example

Make a picture

gr=Show[Graphics[{{Hue[.2],Polygon[{{0,0},{1,0},{1,1}}]},
        {AbsolutePointSize[22],Hue[0],Point[{.25,.6}]},
        AbsoluteThickness[10],Hue[.7], Line[{{0,.5},{1,0}}]}],
    Frame->True]

Define a function

f[pnt_]:= {{1,2},{-2,1}}.pnt

Apply the function

Show[Trans[f][gr]]

Try,

g[{x_, y_}] := {Sin[x + y], x - y};

in place of f.
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Tony" <tony at magic101.freeserve.co.uk> wrote in message
news:96iq59$d7v at smc.vnet.net...
> Does mathematica do reflections rotations of a given shape.
> I mean if I plot a triangle if I had a fuction such as
>
> f: R2 --> R2
> (x,y) I--->(y,x)
>
> Would mathematica do this and would it carry out composite function such
as
> GoF   and FoG etc
>
> Oh so many questions to ask and so little time to .........
>
> Tony
>
>
>




  • Prev by Date: Re: numerics
  • Next by Date: Re: Combination Algorithm without brut force - Combine 4's into least 6's
  • Previous by thread: Questions
  • Next by thread: RE: Questions