Here is a slightly updated version of my
PPL program, with some simplification, improvement in the results accuracy using ROUND instead of IP, and also using the Function App to do the calculation of the values for the extrema date, as well as to show graphically the different biorhythms centered around the next extrema date:
Code:
EXPORT EXTREMA(BD)
BEGIN
LOCAL d1,d3;
// Find Next Extrema date
N:=DDAYS(BD,Date);
A:=IP(2*N/23-1/2);
B:=IP(2*N/28-1/2);
C:=IP(2*N/33-1/2);
L1:=MAKELIST(23/2*(1/2+I),I,A+1,A+33); L4:=IP(L1);
L2:=MAKELIST(28/2*(1/2+I),I,B+1,B+33);
L3:=MAKELIST(33/2*(1/2+I),I,C+1,C+33); L5:=IP(L3);
D:=MIN(head(INTERSECT(L4,L2)),head(INTERSECT(L2,L5)),head(INTERSECT(L4,L5)));
E:=DATEADD(BD,D);
// Display results using the Function App: first text, then a graphic view centered on the next extrema
STARTAPP("Function");
F1:='100*SIN(4*ACOS(0)*(X MOD 23)/23)';
F2:='100*SIN(4*ACOS(0)*(X MOD 28)/28)';
F3:='100*SIN(4*ACOS(0)*(X MOD 33)/33)';
Xmin:=D-40; Xmax:=D+40; Ymin:=-110; Ymax:=110; Xtick:=5; Ytick:=10;
PRINT("Birthday : "+STRING(BD,2,4));
PRINT("Next Extrema Date: "+STRING(E,2,4));
d1:=IFTE(POS(L4,D),L1(POS(L4,D)),D);
d3:=IFTE(POS(L5,D),L3(POS(L5,D)),D);
PRINT("Physical: "+ROUND(F1(d1),0));
PRINT("Emotional: "+ROUND(F2(D),0));
PRINT("Intellectual: "+ROUND(F3(d3),0));
CHECK({1,2,3});UNCHECK({0,4,5,6,7,8,9});
STARTVIEW(1);
RETURN E;
END;