Difference between revisions of "ZCubes/Clock Angle Problem"
Jump to navigation
Jump to search
(→Video) |
|||
Line 4: | Line 4: | ||
==Video== | ==Video== | ||
<br/> | <br/> | ||
− | {{#ev:youtube|iDeL1T4jqag|480|left| | + | {{#ev:youtube|iDeL1T4jqag|480|left|Clock Angle Problem}} |
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> | ||
+ | ==ZCubes Code== | ||
+ | <pre> | ||
+ | hangle=360/12; | ||
+ | mhangle=360/12/60; | ||
+ | shangle=360/12/60/60; | ||
+ | mangle=360/(60); | ||
+ | smangle=360/(60)/60; | ||
+ | sangle=360/(60); | ||
+ | [0..11,0..59,0..59] | ||
+ | @( | ||
+ | function hm(h,m,s) | ||
+ | { | ||
+ | return( | ||
+ | [h,m,s, | ||
+ | ABS( | ||
+ | (h*hangle+m*mhangle+s*shangle) | ||
+ | - | ||
+ | (m*mangle+s*smangle) | ||
+ | ) | ||
+ | <=smangle/2.01 //2 //2.5 | ||
+ | ] | ||
+ | ) | ||
+ | } | ||
+ | ) | ||
+ | .filter(r=>r[0][3]==true) | ||
+ | </pre> | ||
<br/> | <br/> |
Latest revision as of 09:08, 16 September 2021
Clock Angle Problem
This video demonstrates how to compute the times when the hour hand, minute hand and seconds hand come on top of each other. ZCubes enables you to compute this using a few lines of easy code. Enjoy watching and try the code in ZCubes.
Video
ZCubes Code
hangle=360/12; mhangle=360/12/60; shangle=360/12/60/60; mangle=360/(60); smangle=360/(60)/60; sangle=360/(60); [0..11,0..59,0..59] @( function hm(h,m,s) { return( [h,m,s, ABS( (h*hangle+m*mhangle+s*shangle) - (m*mangle+s*smangle) ) <=smangle/2.01 //2 //2.5 ] ) } ) .filter(r=>r[0][3]==true)
© Copyright 1996-2021, ZCubes, Inc.