MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

solving a periodic function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113930] solving a periodic function
  • From: Michael Stern <nycstern at gmail.com>
  • Date: Thu, 18 Nov 2010 07:06:24 -0500 (EST)

I have a fun little puzzle that I solved via other methods, but would 
like to know if there might have been a more elegant method via 
Mathematica.

I wanted to figure out the times during the day at which the hour hand 
and minute hand of a clock line up perfectly. I worked in terms of "unit 
time", in which the 12 hours of the clock are represented as ranging 
from 0 to 1. It is then easy to arrive at

unitTimeToMinuteAngle[unitTime_Real] := 4320 Mod[unitTime, 1/12]

unitTimeToHourAngle[unitTime_Real] := unitTime*360 // N

and

unstraightness[unitTime_] :=
 Abs[Abs[unitTimeToMinuteAngle[unitTime] - 
unitTimeToHourAngle[unitTime]] - 180]

Plotting the problem shows that we have 11 solutions in each 12 hour 
period.

Plot[unstraightness[unitTime], {unitTime, 0, .999999}]

I would like to be able to solve the problem with something like

NSolve[unstraightness[unitTime] == 0, unitTime]

but "This system cannot be solved with the methods available to NSolve," 
and I get similar errors with other Mathematica solution methods.

Ultimately, I solved via brute force, finding the "unstraightness" for a 
vast number of time slices and selecting the 11 straightest. The results 
are good, but there must be an elegant way to have found this in a few 
mathematica commands. I'd appreciate any insight.

-Michael


p.s. the solutions are evenly spaced at the following times
{
 {"12:32:43.6364"},
 {"1:38:10.9091"},
 {"2:43:38.1818"},
 {"3:49:5.45455"},
 {"4:54:32.7273"},
 {"6:00:00."},
 {"7:5:27.2727"},
 {"8:10:54.5455"},
 {"9:16:21.8182"},
 {"10:21:49.0909"},
 {"11:27:16.3636"}
}


  • Prev by Date: Re: band pass or notch filtering?
  • Next by Date: Re: Does activating 8 disable 7?
  • Previous by thread: Re: Mathematica 8 "natural language" capabilities
  • Next by thread: Re: solving a periodic function