TruerWords Logo
Google
 
Web www.truerwords.net

Search TruerWords

Welcome
Sign Up  Log On

“Re: Swift Spirals”

From: Mike In Response To: 6419  Swift Spirals
Date Posted: Saturday, April 11, 2015 5:02:12 PM Replies: 0
   
Enclosures: butterfly_bottom.gif (21K), butterfly_top.gif (13K), grad1.gif (2K), image2.gif (5K)
Obviously, they meet at 3:31 PM. Oh, wait, they didn't give any speeds or a start time or dimensions of the square. 
 
 
 
 
-------Original Message-------
 
Date: 4/11/2015 11:02:37 AM
Subject: [tw] Swift Spirals [Msg#6419]
 
--------------------------------
 
Yesterday on Quora <http://www.quora.com/> a particular Math question
caught my attention and fired up my imagination. I've already linked to it,
but here's how the question was worded:
 
   Four persons K, L, M, and N are initially at the four corners of a
   square of side 'd'. Each person now moves with a uniform speed of 'v'
   in such a way that K always moves directly towards L, L directly
   towards M, M directly towards N and N directly towards K. At what time
   will the four persons meet?
 
(Why call them people and then not give them real names? I thought that was
funny.)
 
Let me rephrase the question. Four people (or uh... dots) are at the corners
of a very large square. They're all going to move at the same time, and keep
moving until they touch. Each person moves toward the next person in the
clockwise direction. (So the person at the top left moves toward the person at
the top right.)
 
I didn't care about the actual question there at the end, "at what time will
the four person's meet?" I was just interested in the path they would each
travel, the shape it would form.
 
Now keep in mind that each person is always moving towards the next person,
not towards the corner where that person started.
 
It was obviously going to be a spiral in toward the center. Could I write a
program that would simulate this travel?
 
Here's an Xcode Playground file
(written in Swift) that demonstrates the whole thing. It's not fancy, but it
does show the spiral being drawn and I've kept the math self-contained in a
couple of functions.
 
--------------------------------
Unsubscribe Instructions:
 

Discussion Thread:

There are no replies.

Trackbacks:

There are no trackbacks.



TruerWords
is Seth Dillingham's
personal web site.
From now on, ending a sentence with a preposition is something up with which I will not put. - WC