Difference between revisions of "ZCubes/Clock Angle Problem"

From ZCubes Wiki
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
 
==Video==
 
==Video==
 
<br/>
 
<br/>
{{#ev:youtube|iDeL1T4jqag|480|left|Brocards Problem & Brown Numbers}}
+
{{#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/>
Line 16: Line 42:
 
<br/>
 
<br/>
 
&copy; Copyright 1996-2021, ZCubes, Inc.
 
&copy; Copyright 1996-2021, ZCubes, Inc.
 
 
Related links-
 
 
 
*[[ZCubes/Computations_with_Units_and_Range_of_Values | Computations with Units  ]]
 
*[[ZCubes/Understanding_Arrays_in_ZCubes| Arrays in ZCubes  ]]
 
*[[ZCubes/Advanced_Spreadsheet_Computations | Advanced Spreadsheet Computations  ]]
 
*[[ZCubes/Writing_Functions_in_ZCubes | Functions in ZCubes]]
 
*[[ZCubes/Programming_in_Z_space_and_CALCI_Spreadsheet | Programming in Z and CALCI Spreadsheet ]]
 

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


Clock Angle Problem














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.