Plot a parametric function from $\mathbb{R}^2$ to $\mathbb{R}^2$

I want to plot the following function defined on $[-1,1]\times[-1,1]\setminus(0,0)$:

$$F(x,y,t)= \begin{cases} (1-t)(x,y)+t(1,\frac{y}{x})& \text{if}\ -x\leq y\leq x \\ (1-t)(x,y)+t(\frac{x}{y},1)& \text{if}\ -y\leq x \leq y \\ (1-t)(x,y)+t(-1,-\frac{y}{x})& \text{if}\quad\ x\leq y \leq -x \\ (1-t)(x,y)+t(-\frac{x}{y},-1)& \text{if}\quad\ y \leq x \leq -y \\ \end{cases}$$

What would be great is if I could write a code which takes two values $a$ and $b$ and then plots something like a moving graph, of where $(a,b)$ goes as $t$ changes.

• Can you post the function in Mathematica code? Look up Piecewise if needed.
– user484
Dec 13 '15 at 21:57
• Start small: Look up Piecewise first and see if you can get that working for a particular choice of t. Then see if you can make the same function with t as a parameter and see if you can plot the individual ones at different t's. Then, once all that's working, look up Manipulate and see if you can get the "animation" working. Finally: I'm a little confused on how you want to plot a function from R2 to R2. Do you want to make a vector field or something? Dec 13 '15 at 21:58

w[x_, y_,
t_] := (1 - t) {x,
y} + (t Sign[ x] Boole[Abs[y] <= Abs[x] ] {1, y/x} +
t Sign[ y] Boole[Abs[y] > Abs[x]] {x/y, 1})
Manipulate[
Row[{Graphics[Point[pts], PlotRange -> Table[{-1, 1}, {2}],
Axes -> True, Frame -> True, ImageSize -> 200],
Graphics[{Red, PointSize[0.03], Point[w[##, t]], Black,
Point[{w[##, 0], w[##, 1]}], Line[{w[##, 0], w[##, 1]}]} & @@
pts, PlotRange -> Table[{-1, 1}, {2}], Axes -> True,
Frame -> True, ImageSize -> 200]}],
{{pts, {-0.2, -0.2}}, Locator}, {t, 0, 1}] • This is beautiful. Thank you! Dec 18 '15 at 1:09

f[x_, y_, t_] := Piecewise[{
{(1 - t) {x, y} + t {1, y/x}, -x <= y <= x},
{(1 - t) {x, y} + t {x/y, 1}, -y <= x <= y},
{(1 - t) {x, y} + t {-1, -(y/x)}, x <= y <= -x},
{(1 - t) {x, y} + t {-(x/y), -1}, y <= x <= -y}
}]

My interpretation of what you want:

Manipulate[
Show[
ParametricPlot[f[a, b, t0], {t0, 0, 1}, PlotRange -> {{-2, 2}, {-2, 2}}, AspectRatio -> 1]
, Graphics[{PointSize[0.02], Red, Point[f[a, b, t]]}]
]
, {t, 0, 1}
, {a, -2, 2}
, {b, -2, 2}
] Another possibility:

Manipulate[VectorPlot[f[x, y, t], {x, -2, 2}, {y, -2, 2}], {t, 0, 1}] 