HP Forums
help - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: help (/thread-13753.html)



help - Fikri bahr - 10-04-2019 02:50 AM

please help complete the formula below from vba to hp prime :

Public Function JDEMinElongTracking(JDE As Double) As Double

Dim JDEAwal As Double
Dim JDEProsess(3)
Dim ELONG(3)
Dim Intervals(7)
Dim ELONGMIN As Double
Dim Hasil As String
Dim I As Integer
Dim J As Integer
Dim k As Integer
Dim L As Integer

Intervals(0) = 1 / 24
Intervals(1) = 1 / 24 / 60
Intervals(2) = 1 / 24 / 60 / 60
Intervals(3) = 1 / 24 / 60 / 60 / 10
Intervals(4) = 1 / 24 / 60 / 60 / 100
Intervals(5) = 1 / 24 / 60 / 60 / 1000
Intervals(6) = 1 / 24 / 60 / 60 / 10000
Intervals(7) = 1 / 24 / 60 / 60 / 100000
JDEAwal = JDE

While I < 7
DoEvents
For J = 0 To 3
If J = 0 Then
JDEProsess(J) = JDE
Else
JDEProsess(J) = JDE + Intervals(I) * J
End If
ELONG(J) = MoonSunGeocentricElongation(JDEProsess(J))
Next


ELONGMIN = ELONG(0)
For k = 0 To 3
If ELONG(k) < ELONGMIN Then ELONGMIN = ELONG(k)
Next

For L = 0 To 3
If ELONG(L) = ELONGMIN Then
If L = 0 Or L = 3 Then
JDE = JDEProsess(L) + Intervals(I) * (L - 1)
Else
JDEMinElongTracking = JDEProsess(L)
On Error Resume Next
JDE = JDEProsess(L) - Intervals(I + 1)
I = I + 1
End If
End If
Next
Wend

End Function


RE: help - TheLastMillennial - 10-05-2019 03:24 AM

You know what this sounds like? A great first project for you to learn the Prime Programming Language (PPL)! Go check out the documentation and tutorials and let us know what specific questions you have!