:

Visualization of "Clock and Degrees" problem

This post in reply to the Post, Maple for "Clock and Degrees" problem

Clock:=proc(H, M)  # H and M - time in hours (0 <= H <= 23) and minutes (0<=M<60)

local A1,A2, A, B, B1, C1, C, E, F,alpha,t, T, T1, T2, P, G;

uses plottools, plots;

A1:=(irem(H,12)+M/60)*30;  A2:=M*6;

A:=circle([0,0], thickness=5);

P:=disk([0,0], 1, color=grey);

B:=seq(line([0.9*cos(2*Pi*k/12),0.9*sin(2*Pi*k/12)], [cos(2*Pi*k/12),sin(2*Pi*k/12)], thickness=5, color=red), k=1..12);

C:=seq(line([0.95*cos(2*Pi*k/60),0.95*sin(2*Pi*k/60)], [cos(2*Pi*k/60),sin(2*Pi*k/60)], color=blue, thickness=3), k=1..60);

B1:=line([0,0], [1.2*sin(A1*Pi/180),1.2*cos(A1*Pi/180)]);

C1:=line([0,0], [1.2*sin(A2*Pi/180),1.2*cos(A2*Pi/180)]);

E:=arrow([0,0], [0.65*sin(A1*Pi/180),0.65*cos(A1*Pi/180)], .05, .1, .15, color=red):

F:=arrow([0,0], [0.8*sin(A2*Pi/180),0.8*cos(A2*Pi/180)], .05, .1, .15, color=blue):

alpha:=min(abs(A1-A2),360-abs(A1-A2));

if A1>=A2 and A1-A2<360-A1+A2 then G:=arc([0,0], 1.15,Pi/2-A2*Pi/180..Pi/2-A1*Pi/180); t:=Pi/2-(A1+A2)*Pi/360; T:=textplot([1.25*cos(t), 1.25*sin(t), cat(convert(alpha, symbol), `  deg`)], font=[TIMES,ITALIC,20]); elif

A1>=A2 and A1-A2>=360-A1+A2 then G:=arc([0,0],1.15,Pi/2-A1*Pi/180..Pi/2-(A2+360)*Pi/180);  t:=Pi/2-(A1+A2+360)*Pi/360; T:=textplot([1.25*cos(t), 1.25*sin(t), cat(convert(alpha, symbol), `  deg`)], font=[TIMES,ITALIC,24]); fi;

if A1<=A2 and A2-A1<360-A2+A1 then G:=arc([0,0], 1.15,Pi/2-A1*Pi/180..Pi/2-A2*Pi/180);

t:=Pi/2-(A1+A2)*Pi/360; T:=textplot([1.25*cos(t), 1.25*sin(t), cat(convert(alpha, symbol), `  deg`)], font=[TIMES,ITALIC,20]); elif

A1<=A2 and A2-A1>=360-A2+A1 then G:=arc([0,0],1.15,Pi/2-A2*Pi/180..Pi/2-(A1+360)*Pi/180); t:=Pi/2-(A1+A2+360)*Pi/360; T:=textplot([1.25*cos(t), 1.25*sin(t), cat(convert(alpha, symbol), `  deg`)], font=[TIMES,ITALIC,20]); fi;

T1:=textplot([0,1/2, Clock], font=[TIMES,ITALIC,28]);

T2:=textplot([[0.85*cos(Pi/2),0.85*sin(Pi/2), 0], [0.85*cos(Pi/3),0.85*sin(Pi/3), 1], [0.85*cos(Pi/6),0.85*sin(Pi/6), 2], [0.85*cos(0),0.85*sin(0), 3], [0.85*cos(-Pi/6),0.85*sin(-Pi/6), 4], [0.85*cos(-Pi/3),0.85*sin(-Pi/3), 5], [0.85*cos(-Pi/2),0.85*sin(-Pi/2), 6], [0.85*cos(-2*Pi/3),0.85*sin(-2*Pi/3), 7], [0.85*cos(-5*Pi/6),0.85*sin(-5*Pi/6), 8], [0.85*cos(-Pi),0.85*sin(-Pi), 9], [0.85*cos(-7*Pi/6),0.85*sin(-7*Pi/6), 10], [0.85*cos(2*Pi/3),0.85*sin(2*Pi/3), 11]], font=[TIMES,ROMAN,26]);

print(cat(`The angle between the hands of the clock is `, convert(alpha, symbol),` degrees`));

display(A, B, B1, C1, C, E, F, P, G, T, T1, T2, axes=none, scaling=constrained);

end proc:

Example:

Clock(7,12);

PS.    3_procedures.mws

﻿