# Computing a Transformation then visualizing with TransformedRegion Function

I have some function $$\psi$$, I compute the transformation $$T = \vec{x} - \nabla \psi$$. I'd like to visualize the action of $$T$$ on a square centered at the origin.

The mathematica website shows some examples of how to compute transformations.

https://reference.wolfram.com/language/ref/TransformedRegion.html

I have two questions:

1. If I want to subimpose the initial region (perhaps in red) under the final region, how would I do this? Also I'd like to add coordinate axes.

2. Below is included a sketch of code. How do I get the coordinates of the gradient I compute into the transformation function. Below is my best guess, but I'm totally lost on how to accomplish this.

Clear["Global*"]
psi = -4 (x^2 + y^2);
Indexed[#, 2] -> y}
R =
TransformedRegion[
Rectangle[], {Indexed[#, 1] - Indexed[gradPsi, 1],
Indexed[#, 2] + Indexed[gradPsi, 2]} &];
Region[R]


psi = -4 (x^2 + y^2);

` • Almost there, thanks!! I meant to say the center of the square is centered at the origin. I think this is the bottom left corner. I'm having a little trouble interpreting the picture. For the example I showed, the Transformation should blow up a box whose center is at the origin by a factor of 9. $T = \langle x - (-8x), y - (-8y) \rangle$ – yoshi Dec 21 '20 at 17:36