- #1

- 1,496

- 2

Code:

```
x0 = 0.0
y0 = 0.0
dx = x - x0
dy = y - y0
radius = sqrt(dx*dx + dy*dy)
theta = atan(dy/dx)
theta = theta + dtheta
x = radius*cos(theta)
y = radius*sin(theta)
```

This works great, however it's very slow. To compute square roots and inverse trig functions in a computer code is very tedious, and when you need to do it for thousands or millions of gridpoints, it can take forever.

My idea was to just write a function for the gridpoints as a function of time alone. I won't be able to store any additional information, such as original or previous position. I had an idea of some sort of phase angle, and I think that would require that.

Also, I cannot simply find the velocity, and then calculate the displacement, and therefore new position, because apparently there are numerical problems and the grid could start to "walk" away from each other.

Hopefully I've explained this well enough, I appreciate any help.