#define floor(x) ((x*2.0-0.5) Shr 1) #define pi (4 * Atn(1)) Function Gregorian(db As String) As Integer Dim As Integer M, Y, D Y = Valint(Left(db,4)) : M = Valint(Mid(db,6,2)) : D = Valint(Right(db,2)) Dim As Integer N = (M+9) - Int((M+9)/12) * 12 Dim As Integer W = Y - Int(N/10) Dim As Integer G = 365 * W + Int(W/4) - Int(W/100) + Int(W/400) G += Int((N*306+5)/10)+(D-1) Return G End Function Function Biorhythm(Birthdate As String, Targetdate As String) As String 'Jagged Array Dim As String TextArray(4,2) = {{"up and rising", "peak"}, {"up but falling", "transition"}, {"down and falling", "valley"}, {"down but rising", "transition"}} Dim As Integer DaysBetween = Gregorian(Targetdate) - Gregorian(Birthdate) Dim As Integer positionP = DaysBetween Mod 23 Dim As Integer positionE = DaysBetween Mod 28 Dim As Integer positionM = DaysBetween Mod 33 'return the positions - just to return something Biorhythm = Str(positionP) & "/" & Str(positionE) & "/" & Str(positionM) Dim As Integer quadrantP = Int(4 * positionP / 23) Dim As Integer quadrantE = Int(4 * positionE / 28) Dim As Integer quadrantM = Int(4 * positionM / 33) Dim As Single percentageP = Fix(100 * Sin(2 * pi * (positionP / 23))) Dim As Single percentageE = Fix(100 * Sin(2 * pi * (positionE / 28))) Dim As Single percentageM = Fix(100 * Sin(2 * pi * (positionM / 33))) Dim As Single transitionP = Val(Targetdate) + floor((quadrantP + 1) / 4 * 23) - positionP Dim As Single transitionE = Val(Targetdate) + floor((quadrantE + 1) / 4 * 28) - positionE Dim As Single transitionM = Val(Targetdate) + floor((quadrantM + 1) / 4 * 33) - positionM Dim As String textP, textE, textM, Header1Text, Header2Text Select Case percentageP Case Is > 95 textP = "Physical day " & positionP & " : " & "peak" Case Is < -95 textP = "Physical day " & positionP & " : " & "valley" Case -5 To 5 textP = "Physical day " & positionP & " : " & "critical transition" Case Else textP = "Physical day " & positionP & " : " & percentageP & "% (" & TextArray(quadrantP,0) & ", next " & TextArray(quadrantP,1) & " " & transitionP & ")" End Select Select Case percentageE Case Is > 95 textE = "Emotional day " & positionE & " : " & "peak" Case Is < -95 textE = "Emotional day " & positionE & " : " & "valley" Case -5 To 5 textE = "Emotional day " & positionE & " : " & "critical transition" Case Else textE = "Emotional day " & positionE & " : " & percentageE & "% (" & TextArray(quadrantE,0) & ", next " & TextArray(quadrantE,1) & " " & transitionE & ")" End Select Select Case percentageM Case Is > 95 textM = "Mental day " & positionM & " : " & "peak" Case Is < -95 textM = "Mental day " & positionM & " : " & "valley" Case -5 To 5 textM = "Mental day " & positionM & " : " & "critical transition" Case Else textM = "Mental day " & positionM & " : " & percentageM & "% (" & TextArray(quadrantM,0) & ", next " & TextArray(quadrantM,1) & " " & transitionM & ")" End Select Header1Text = "Born " & Birthdate & ", Target " & Targetdate Header2Text = "Day " & DaysBetween Print Header1Text Print Header2Text Print textP Print textE Print textM Print End Function Biorhythm("1943-03-09", "1972-07-11") Biorhythm("1809-02-12", "1863-11-19") 'correct DOB for Abraham Lincoln Biorhythm("1809-01-12", "1863-11-19")