Curly Trajectory

At time t = 0 t = 0 , a particle of mass 1 1 in the ( x , y ) (x,y) plane has the following position and velocity:

( x , y ) = ( 0 , 0 ) ( x ˙ , y ˙ ) = ( 15 , 10 ) (x,y) = (0,0) \\ (\dot{x},\dot{y}) = (15,10)

The particle experiences the following force:

F = ( F x , F y ) = ( 30 y ˙ sin ( t ) , 30 x ˙ sin ( t ) ) \vec{F} = (F_x,F_y) = \Big( -30 \, \dot{y} \, \sin (t) ,30 \, \dot{x} \, \sin (t) \Big)

How far from the origin is the particle at t = 12 t = 12 ?


The answer is 16.98.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Chris Lewis
Jun 7, 2019

It's convenient to rewrite the system as follows:

x ˙ = u \dot{x}=u

y ˙ = v \dot{y}=v

u ˙ = 30 v sin t \dot{u}=-30v \sin{t}

v ˙ = 30 u sin t \dot{v}=30u \sin{t}

subject to the initial conditions x ( 0 ) = y ( 0 ) = 0 x(0)=y(0)=0 , u ( 0 ) = 15 u(0)=15 , v ( 0 ) = 10 v(0)=10 .

Although we've introduced more variables, making the system larger, it is now first order, and easier to handle. Note that the sub-system in u u and v v is entirely self-contained; we can solve for ( u , v ) (u,v) first, then integrate to find ( x , y ) (x,y) .

I tried a few approaches to this.

  • Numerical solution using an explicit Euler method

This felt like a well-devised trap that I fell into. The method fails, terribly, even for very small step sizes.

[Edit: turns out, this wasn't a trap at all and should have worked - see the comments below]

  • Numerical solution using an implicit Euler method

This worked better, though still needed small step sizes to work. The scheme is as follows:

r k + 1 = ( I h A k + 1 ) 1 r k \mathbf{r_{k+1}}=(\mathbf{I}-h\mathbf{A_{k+1}})^{-1} \mathbf{r_k}

where r k = ( u k v k ) \mathbf{r_k}=\begin{pmatrix} u_k\\ v_k \end{pmatrix} , A k = ( 0 30 sin t k 30 sin t k 0 ) \mathbf{A_k}=\begin{pmatrix} 0 & -30\sin{t_k}\\ 30\sin{t_k} & 0 \end{pmatrix} , t k = k h t_k = kh , and h h is the step-size. This is not as bad to implement as I made it look!

Once the u u and v v values were calculated up to t = 12 t=12 , I just used numerical integration to get x x and y y (the position of the particle after this time).

The results for a few h h -values are below:

h h Distance from origin at t = 12 t=12
0.0001 15.0783
0.00001 16.7741...
0.000001 16.9581...
0.0000001 16.9766...

These values seem to be converging, but slowly. Quite a handy trick here is to extrapolate from these data points using the ratio of the differences in the successive answers. Using this gave an estimate of 16.97875 16.97875\ldots for the answer.

  • Partial analytic solution

And this is what I should have done first. Going back to the system of equations, we have

u ˙ = 30 v sin t \dot{u}=-30v \sin{t}

v ˙ = 30 u sin t \dot{v}=30u \sin{t}

Dividing through, u ˙ v ˙ = v u \frac{\dot{u}}{\dot{v}}=-\frac{v}{u}

Simplifying, u ˙ u + v ˙ v = 0 \dot{u}u+\dot{v}v=0

so that u 2 + v 2 = const. u^2+v^2=\text{const.}

From the initial values, the constant is 325 325 .

We can now substitute v = 325 u 2 v=\sqrt{325-u^2} to give

u ˙ = 30 325 u 2 sin t \dot{u}=-30\sqrt{325-u^2} \sin{t} , which is a separable equation. With the initial condition u ( 0 ) = 15 u(0)=15 , the solution is

u ( t ) = 5 13 sin ( 30 cos ( t ) + 30 sin 1 ( 3 13 ) ) u(t)=-5\sqrt{13} \sin {\left( -30 \cos(t)+30-\sin^{-1} {\left(\frac{3}{\sqrt{13}}\right)} \right)}

Likewise, v ( t ) = 5 13 sin ( 30 cos ( t ) + 30 + sin 1 ( 2 13 ) ) v(t)=5\sqrt{13} \sin {\left( -30 \cos(t)+30+\sin^{-1} {\left(\frac{2}{\sqrt{13}}\right)} \right)}

Integrating these numerically, we find that x ( 12 ) = 13.0505 x(12)=-13.0505\ldots and y ( 12 ) = 10.861 y(12)=10.861\ldots , giving the particle's distance from the origin as 16.9787 \boxed{16.9787\ldots} .

Interesting. I used explicit Euler and it converged reasonably nicely. I used timesteps of 1 0 5 10^{-5} , 1 0 6 10^{-6} , and 1 0 7 10^{-7} . The difference between the 1 0 6 10^{-6} result and the 1 0 7 10^{-7} was negligible

Steven Chase - 2 years ago

Log in to reply

How come your explicit Euler converged reasonably? I implemented pretty much the exact same code as you, and found for timestep 1 0 5 10^{-5} it was very inaccurate. Only 1 0 7 10^{-7} actually produced 16.98, as opposed to 16.99, which 1 0 6 10^{-6} produces. By the way, the code takes about 10 seconds to run for a 1 0 6 10^{-6} timestep despite my great computer processor.

Krishna Karthik - 1 year, 1 month ago

Log in to reply

I think the only difference is how we define "reasonably nicely". In my opinion, your results for 1 0 5 , 1 0 6 , 1 0 7 10^{-5}, 10^{-6}, 10^{-7} show acceptable convergence

Steven Chase - 1 year, 1 month ago

Well, that would have saved some time! I must have made a mistake in my implementation.

Still, I was very surprised the analytical solution at least partly worked.

How did you come up with this system? (Oh, and what did you use to plot the trajectory?)

Chris Lewis - 2 years ago

I got interested in generating random smooth curves from physics principles some time ago (see the linked note). This is basically just a slightly better-behaved version of that. I just use Python to spit out the (x,y) coordinates, and then I plot as an (x,y) scatter in Excel.

https://brilliant.org/discussions/thread/generating-random-smooth-curves-using-physics/

Steven Chase - 2 years ago

Log in to reply

That's awesome - thanks for sharing. Looks like I really missed the point trying for an analytical solution! Would you mind posting your Python code for this one? (I did my coding using VBA, of all things!)

Chris Lewis - 2 years ago

Log in to reply

I posted the Python code as a solution. I did some "Hello World"-level stuff in highschool with Visual Basic, but didn't do any math in it. Is it easy to use for math calculations?

Steven Chase - 2 years ago

Log in to reply

@Steven Chase VBA is easy to use in general, if you grew up coding BASIC-style languages (as I did), but it's not really designed for maths calculations in the way that Python and its modules are (eg no vector handling). It's also not as efficient in terms of runtime - that's what put me off step sizes of 10^-7, whereas, of course, what I should be doing is learning Python (to that end, thank you for your code!)

Where VBA in Excel can be useful is manipulating objects in Excel, though, so occasionally I'll use it for constructing diagrams.

Chris Lewis - 2 years ago
Steven Chase
Jun 7, 2019

Simulation code (Python). This uses explicit Euler integration with a very small time step.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import math

dt = 10.0**(-7.0)
t = 0.0

m = 1.0

x = 0.0
y = 0.0

xd = 15.0
yd = 10.0

xdd = 0.0
ydd = 0.0

while t <= 12.0:

    x = x + xd * dt
    y = y + yd * dt

    xd = xd + xdd * dt
    yd = yd + ydd * dt

    Fx = -30.0 * yd * math.sin(t)
    Fy = 30.0 * xd * math.sin(t)

    xdd = Fx/m
    ydd = Fy/m

    t = t + dt

print math.hypot(x,y)  # Returns 16.98

Karan Chatrath
Jun 7, 2019

I do not have any solution to add to this problem. Even I solved it numerically. I was just playing around with the initial conditions and I was surprised to see the genesis of some very beautiful looking solutions. I have attached a screenshot.

What I find really remarkable is that solving a simple set of equations can yield such patterns. There is indeed beauty hidden in mathematics. Maybe this tells us more than what we can appreciate with our current state of knowledge. Good examples of such patterns are the Lorenz strange attractor and the Mandelbrot set.

As always, a very nice problem!

That's really cool. It could be an art piece in somebody's house. I can't draw, but I have made some fairly nice math art before.

Steven Chase - 2 years ago

Log in to reply

Yes, I saw the link you posted on random smooth curves. I will go through it soon. Thanks!

Karan Chatrath - 2 years ago

Very pretty! I'd point out, though, that this is not exhibiting chaotic behaviour like the Mandelbrot set or Lorenz attractor (which is itself perhaps a little surprising at first, though there are good reasons for this). If you look carefully you'll see the plotted curves are all rotations and translations of each other.

Chris Lewis - 2 years ago

That is a good point. The system here, unlike the examples I gave is not chaotic. Mainly because the given dynamical system is linear. One of many pre requisites for a chaotic system is non-linearity. Thank you for sharing the link.

Karan Chatrath - 2 years ago

Beautiful renderings!

Krishna Karthik - 1 year, 1 month ago
Krishna Karthik
Apr 13, 2020

Here is my code, which uses Explicit Euler Integration. Given the nature of the differential equations that describe the system, I don't think Explicit Euler is the best method. The code is actually pretty inaccurate for even slightly greater timesteps; the timestep which will yield a satisfactory result is 1 0 6 10^{-6} . It needs hardware acceleration; CUDA python is the best way to go. At the end of the code, the results are shown at various values of deltaT, as are the times taken to compile the code at the values of deltaT.

The code takes a long time to compile as the step size increases. The error in the result is dependent on step size. The Euler method is inaccurate and the convergence of the result is very slow. It is also very time consuming to compute such small values of deltaT on the CPU, and get an inaccurate result nevertheless. A better method which has O ( n 4 ) O(n^4) error would be Runge-Kutta.

Edit: I have tried it with a modified Euler technique below as well:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import math

x = 0
y = 0


time = 0
deltaT = 10**-6


xDot = 15
yDot = 10




while time <= 12:
    xDotDot = -30*yDot*math.sin(time)
    yDotDot = 30*xDot*math.sin(time)

    xDot = xDot + xDotDot*deltaT
    yDot = yDot + yDotDot*deltaT

    x = x + xDot*deltaT 
    y = y + yDot*deltaT 


    time = time + deltaT


print("x: " +str(x))
print("y: " +str(y))
print("distance: " +str(math.hypot(x,y)))

#Results: 

#deltaT = 10**-1: distance = 6.100549268950116e+39 (error is dependent on size of deltaT; 0.1 too large a step size for Euler)
#deltaT = 10**-2: distance = 672596301067.0984 (still very large)
#deltaT = 10**-3: distance = 71.69830313999711 (getting into 2 digits)
#deltaT = 10**-4: distance = 19.218083697766765 (slightly more accurate)
#deltaT = 10**-5: distance = 17.186272731008557 (reasonably accurate)
#deltaT = 10**-6: distance = 16.999350040357143 (a good result)
#deltaT = 10**-7: distance = 16.98(approx) (results converge towards 16.98)


#specs: Intel i7-9750H laptop processor; 16GB 3200 Mhz RAM
#time taken to compile code for values of deltaT

# <1 sec - 10**-1
# <1 sec - 10**-2
# <1 sec - 10**-3
# <1 sec - 10**-4
#  2 sec - 10**-5
#  14 sec - 10**-6
#  2 minutes - 10**-7

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...