Переписываю небольшую прогу из фортрана в Visual Basic
Подскажите, кто знает, :
на фортране используется EXTERNAL P
как это перевести на Visual Basic ?
Option Explicit
Sub Main()
Dim N As Long, M As Long, I As Long
Dim FUN As Double, RESLT As Double, Time As Double, DT As Double, V(1 To 20) As Double
N = 6
N = 1
Time = 0#
DT = 10#
For I = 1 To 20
Time = Time + DT
Call STEFS(N, Time, RESLT, V, M)
M = N
FUN = 1 / Sqr(3.1416 * Time)
Debug.Print Time, RESLT, FUN
Next
Stop
End Sub
Function FLAPL(ByVal S As Double) As Double
FLAPL = 1# / Sqr(S)
End Function
Sub STEFS(ByVal N As Long, ByVal T As Double, F As Double, V() As Double, ByVal M As Long)
Dim NH As Long, SN As Long, I As Long, K As Long, K1 As Long, K2 As Long
Dim G(1 To 20) As Double, H(1 To 10) As Double, A As Double
If M <> N Then
G(1) = 1#
NH = N / 2
For I = 1 To N
G(I + 1) = G(I) * I
Next
H(1) = 2# / G(NH)
For I = 2 To NH
H(I) = Exp(NH * Log(I)) * G(2 * I + 1) / (G(NH - I + 1) * G(I + 1) * G(I))
Next
SN = 2 * (NH - (NH / 2) * 2) - 1
For I = 1 To N
V(I) = 0#
K1 = (I + 1) / 2
K2 = IIf(I < NH, I, NH)
For K = K1 To K2
V(I) = V(I) + H(K) / (G(I - K + 1) * G(2 * K - I + 1))
Next
V(I) = SN * V(I)
SN = -SN
Next
M = N
End If
F = 0#
A = 2#
A = Log(A) / T
For I = 1 To N
F = F + V(I) * FLAPL(I * A)
Next
F = A * F
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 101