Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ereduverseau

Pages: [1]
1
Programs / To extrapole by model a suit of data
« on: March 30, 2022, 03:21:23 pm »
$Debug
```
$Debug
PI = _Pi
d1 = 2: d2 = 10: d3 = 5: d4 = 8: d5 = 3: d6 = 2: d7 = 4: d8 = 5: d9 = 1
DT(0) = d9 + d1 * Sin(-5 * PI * 2 / d2) + d3 * Sin(-5 * PI * 2 / d4) + d5 * (1 - Cos(-5 * PI * 2 / d6)) + d7 * (1 - Cos(-5 * PI * 2 / d8))
DT(1) = d9 + d1 * Sin(-4 * PI * 2 / d2) + d3 * Sin(-4 * PI * 2 / d4) + d5 * (1 - Cos(-4 * PI * 2 / d6)) + d7 * (1 - Cos(-4 * PI * 2 / d8))
DT(2) = d9 + d1 * Sin(-3 * PI * 2 / d2) + d3 * Sin(-3 * PI * 2 / d4) + d5 * (1 - Cos(-3 * PI * 2 / d6)) + d7 * (1 - Cos(-3 * PI * 2 / d8))
DT(3) = d9 + d1 * Sin(-2 * PI * 2 / d2) + d3 * Sin(-2 * PI * 2 / d4) + d5 * (1 - Cos(-2 * PI * 2 / d6)) + d7 * (1 - Cos(-2 * PI * 2 / d8))
DT(4) = d9 + d1 * Sin(-1 * PI * 2 / d2) + d3 * Sin(-1 * PI * 2 / d4) + d5 * (1 - Cos(-1 * PI * 2 / d6)) + d7 * (1 - Cos(-1 * PI * 2 / d8))
DT(5) = d9
DT(6) = d9 + d1 * Sin(1 * PI * 2 / d3) + f * Sin(1 * PI * 2 / d4) + d5 * (1 - Cos(1 * PI * 2 / d6)) + d7 * (1 - Cos(1 * PI * 2 / d8))
DT(7) = d9 + d1 * Sin(2 * PI * 2 / d3) + f * Sin(2 * PI * 2 / d4) + d5 * (1 - Cos(2 * PI * 2 / d6)) + d7 * (1 - Cos(2 * PI * 2 / d8))
DT(8) = d9 + d1 * Sin(3 * PI * 2 / d3) + f * Sin(3 * PI * 2 / d4) + d5 * (1 - Cos(3 * PI * 2 / d6)) + d7 * (1 - Cos(3 * PI * 2 / d8))
DT(9) = d9 + d1 * Sin(4 * PI * 2 / d3) + f * Sin(4 * PI * 2 / d4) + d5 * (1 - Cos(4 * PI * 2 / d6)) + d7 * (1 - Cos(4 * PI * 2 / d8))
DT(10) = d9 + di * Sin(-5 * PI * 2 / d3) + f * Sin(-5 * PI * 2 / d4) + d5 * (1 - Cos(-5 * PI * 2 / d6)) + d7 * (1 - Cos(-5 * PI * 2 / d8))

For I = 1 To 5: DS(I) = (DT(5 + I) - DT(5 - I)) / 2: DC(I) = (DT(5 + I) + DT(5 - I)) / 2 - DT(5): Next I

MS = 50
For T3 = 1 To 30 Step 1
    If T3 = 1 Or T3 = 2 Then GoTo 3
    For T4 = T3 + 1 To 30 Step 1
        If T4 = 1 Or T4 = 2 Then GoTo 2

        For I = 1 To 4
            S(I, 1) = DS(I)
            S(I, 2) = Sin(2 * PI * I / T3)
            S(I, 3) = Sin(2 * PI * I / T4)
            S(I, 4) = 1
        Next I
        For j = 1 To 4
            S(5, j) = S(1, j)
            S(6, j) = S(2, j)
        Next j
        D1S = S(1, 1) * S(2, 2) * S(3, 3) + S(2, 1) * S(3, 2) * S(1, 3) + S(3, 1) * S(1, 2) * S(2, 3) - S(1, 1) * S(3, 2) * S(2, 3) - S(2, 1) * S(1, 2) * S(3, 3) - S(3, 1) * S(2, 2) * S(1, 3)
        D2S = S(2, 1) * S(3, 2) * S(4, 3) + S(3, 1) * S(4, 2) * S(2, 3) + S(4, 1) * S(2, 2) * S(3, 3) - S(2, 1) * S(4, 2) * S(3, 3) - S(3, 1) * S(2, 2) * S(4, 3) - S(4, 1) * S(3, 2) * S(2, 3)
        D3S = S(3, 1) * S(4, 2) * S(5, 3) + S(4, 1) * S(5, 2) * S(3, 3) + S(5, 1) * S(3, 2) * S(4, 3) - S(3, 1) * S(5, 2) * S(4, 3) - S(4, 1) * S(3, 2) * S(5, 3) - S(5, 1) * S(4, 2) * S(3, 3)
        D4S = S(4, 1) * S(5, 2) * S(6, 3) + S(5, 1) * S(6, 2) * S(4, 3) + S(6, 1) * S(4, 2) * S(5, 3) - S(4, 1) * S(6, 2) * S(5, 3) - S(5, 1) * S(4, 2) * S(6, 3) - S(6, 1) * S(5, 2) * S(4, 3)
        DETS = -S(4, 4) * D1S + S(1, 4) * D2S - S(2, 4) * D3S + S(3, 4) * D4S

        If Abs(DETS) <= MS Then GoTo 1 Else GoTo 2
        1 MS = Abs(DETS)
        TT3 = T3
        TT4 = T4
    2 Next T4
3 Next T3
Print MS
Print "TT3="; TT3; "TT4="; TT4


MAS = 100
For AS1 = -10 To 10 Step 1
    If AS1 = 0 Then GoTo 6
    For AS2 = AS1 To 10 Step 1
        If AS1 = 0 Then GoTo 5
        DS(1) = AS1 * Sin(2 * PI * 1 / TT3) + AS2 * Sin(2 * PI * 1 / TT4)
        DS(2) = AS1 * Sin(2 * PI * 2 / TT3) + AS2 * Sin(2 * PI * 2 / TT4)
        DS(3) = AS1 * Sin(2 * PI * 3 / TT3) + AS2 * Sin(2 * PI * 3 / TT4)
        DS(4) = AS1 * Sin(2 * PI * 4 / TT3) + AS2 * Sin(2 * PI * 4 / TT4)
        DS(5) = AS1 * Sin(2 * PI * 5 / TT3) + AS2 * Sin(2 * PI * 5 / TT4)
        For I = 1 To 5
            AS3(I, 1) = DS(I) ^ 2
            AS3(I, 2) = (Sin(2 * PI * I / TT3)) ^ 2
            AS3(I, 3) = (Sin(2 * PI * I / TT4)) ^ 2
            AS3(I, 4) = 2 * Sin(2 * PI * I / TT3) * Sin(2 * PI * I / TT4)
            AS3(I, 5) = 1
            For j = 1 To 5: d(I, j) = AS3(I, j): Next j
        Next I
        GoSub 13
        DETAS = DETA
        If Abs(DETAS) <= MAS Then GoTo 4 Else GoTo 5
        4 MAS = Abs(DETAS)
        ASS1 = AS1
        ASS2 = AS2
    5 Next AS2
6 Next AS1
Print "MAS="; MAS
Print "AS1="; ASS1; "AS2="; ASS2

MC = 50
For T1 = 2 To 25 Step 1
    If T1 = 1 Then GoTo 9
    For T2 = T1 + 1 To 25 Step 1
        If T2 = 1 Then GoTo 8

        For I = 1 To 4
            C(I, 1) = DC(I)
            C(I, 2) = 1 - Cos(2 * PI * I / T1)
            C(I, 3) = 1 - Cos(2 * PI * I / T2)
            C(I, 4) = 1
        Next I
        For j = 1 To 4
            C(5, j) = C(1, j)
            C(6, j) = C(2, j)
        Next j

        D1C = C(1, 1) * C(2, 2) * C(3, 3) + C(2, 1) * C(3, 2) * C(1, 3) + C(3, 1) * C(1, 2) * C(2, 3) - C(1, 1) * C(3, 2) * C(2, 3) - C(2, 1) * C(1, 2) * C(3, 3) - C(3, 1) * C(2, 2) * C(1, 3)
        D2C = C(2, 1) * C(3, 2) * C(4, 3) + C(3, 1) * C(4, 2) * C(2, 3) + C(4, 1) * C(2, 2) * C(3, 3) - C(2, 1) * C(4, 2) * C(3, 3) - C(3, 1) * C(2, 2) * C(4, 3) - C(4, 1) * C(3, 2) * C(2, 3)
        D3C = C(3, 1) * C(4, 2) * C(5, 3) + C(4, 1) * C(5, 2) * C(3, 3) + C(5, 1) * C(3, 2) * C(4, 3) - C(3, 1) * C(5, 2) * C(4, 3) - C(4, 1) * C(3, 2) * C(5, 3) - C(5, 1) * C(4, 2) * C(3, 3)
        D4C = C(4, 1) * C(5, 2) * C(6, 3) + C(5, 1) * C(6, 2) * C(4, 3) + C(6, 1) * C(4, 2) * C(5, 3) - C(4, 1) * C(6, 2) * C(5, 3) - C(5, 1) * C(4, 2) * C(6, 3) - C(6, 1) * C(5, 2) * C(4, 3)
        DETC = -C(4, 4) * D1C + C(1, 4) * D2C - C(2, 4) * D3C + C(3, 4) * D4C
        If Abs(DETC) <= MC Then GoTo 7 Else GoTo 8
        7 MC = Abs(DETC)
        TT1 = T1
        TT2 = T2
    8 Next T2
9 Next T1
Print MC
Print "TT1="; TT1; "TT2="; TT2

'yc(t) = DC(t) = AC1 * (1-cos(2 * _Pi * t / T1) + AC2 * (1-cosn(2 * _Pi * t / T2)  model of the even part, in french "paire" '

MAC = 100
For AC1 = -10 To 10 Step 1
    If AC1 = 0 Then GoTo 12
    For AC2 = AC1 To 10 Step 1
        If AC2 = 0 Then GoTo 11

        DC(1) = AC1 * (1 - Cos(2 * PI * 1 / TT1)) + AC2 * (1 - Cos(2 * PI * 1 / TT2))
        DC(2) = AC1 * (1 - Cos(2 * PI * 2 / TT1)) + AC2 * (1 - Cos(2 * PI * 2 / TT2))
        DC(3) = AC1 * (1 - Cos(2 * PI * 3 / TT1)) + AC2 * (1 - Cos(2 * PI * 3 / TT2))
        DC(4) = AC1 * (1 - Cos(2 * PI * 4 / TT1)) + AC2 * (1 - Cos(2 * PI * 4 / TT2))
        DC(5) = AC1 * (1 - Cos(2 * PI * 5 / TT1)) + AC2 * (1 - Cos(2 * PI * 5 / TT2))
        For I = 1 To 5
            AC(I, 1) = DC(I) ^ 2
            AC(I, 2) = (1 - Cos(2 * PI * I / TT1)) ^ 2
            AC(I, 3) = (1 - Cos(2 * PI * I / TT2)) ^ 2
            AC(I, 4) = 2 * (1 - Cos(2 * PI * I / TT1)) * (1 - Cos(2 * PI * I / TT2))
            AC(I, 5) = 1
            For j = 1 To 5: d(I, j) = AC(I, j): Next j
        Next I
        GoSub 13
        DETAC = DETA
        If Abs(DETAC) <= MAC Then GoTo 10 Else GoTo 11
        10 MAC = Abs(DETAC)
        ACC1 = AC1
        ACC2 = AC2
    11 Next AC2
12 Next AC1
Print "MAC="; MAC
Print "AC1="; ACC1; "AC2="; ACC2
End
13 Dim d(5, 5) As Double
DETA = Determinant(d())
Return

Sub SubMatrix (s() As Double, d() As Double, r As Integer, c As Integer)
    Dim As Integer j, k
    Dim As Integer y, x
    y = 0
    For j = 1 To UBound(d, 1)
        If (j <> r) Then
            y = y + 1
            x = 0
            For k = 1 To UBound(d, 2)
                If (k <> c) Then
                    x = x + 1
                    s(y, x) = d(j, k)
                End If
            Next
        End If
    Next
End Sub

Function Determinant (d() As Double)
    Dim TheReturn As Double
    Dim As Double f
    Dim As Integer n, j
    n = UBound(d, 1)
    If (n = 1) Then
        TheReturn = d(1, 1)
    End If
    If (n = 2) Then
        TheReturn = d(1, 1) * d(2, 2) - d(1, 2) * d(2, 1)
    End If
    If (n > 2) Then
        Dim b(n - 1, n - 1) As Double
        For j = 1 To n
            Call SubMatrix(b(), d(), 1, j)
            f = Determinant(b())
            If (j Mod 2 = 0) Then f = -f
            TheReturn = TheReturn + d(1, j) * f
        Next
    End If
    Determinant = TheReturn
End Function

                 ```
Code: QB64: [Select]
  1.  

Pages: [1]