MathGroup Archive 2010

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

Search the Archive

solving a periodic function

  • To: mathgroup at
  • Subject: [mg113930] solving a periodic function
  • From: Michael Stern <nycstern at>
  • 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 

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


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

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

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.


p.s. the solutions are evenly spaced at the following times

  • 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