Author Topic: To extrapole by model a suit of data  (Read 4032 times)

0 Members and 1 Guest are viewing this topic.

Offline ereduverseau

  • Newbie
  • Posts: 1
    • View Profile
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.  
« Last Edit: April 01, 2022, 06:05:19 pm by ereduverseau »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: To extrapole by model a suit of data
« Reply #1 on: March 30, 2022, 03:55:57 pm »
Welcome @ereduverseau glad you made it all the way from France.

You will find the code tag here (see attached).

 
Code tag.PNG


Try the modify button, select all the code then click that code tag button.

Your code should then be in readable scrolling window after you save the change.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: To extrapole by model a suit of data
« Reply #2 on: March 30, 2022, 09:30:06 pm »
Don't know what the heck you are doing but this kind of thing:
Code: QB64: [Select]
  1.         If Abs(DETS) <= MS Then GoTo 1 Else GoTo 2
  2.        1 MS = Abs(DETS)
  3.         TT3 = T3
  4.         TT4 = T4
  5.    2 Next T4
  6.  
  7.  

Can be easily replaced by:
Code: QB64: [Select]
  1.         If Abs(DETS) <= MS Then
  2.            MS = Abs(DETS)
  3.            TT3 = T3
  4.            TT4 = T4
  5.         end if
  6.    Next T4
  7.  

and that will also fix your duplicate label problem ie you have 2 places for line #4, 5, and 6

I changed all AS() to AAS( to avoid the name conflict with AS Keyword so we have this code now OK with IDE:
Code: QB64: [Select]
  1.  
  2. aa = 2: b = 10: cc = 5: dd = 8: e = 3: f = 2: g = 4: h = 5: q = 1
  3. a = 2: b = 10: c = 5: d = 8: e = 3: f = 2: g = 4: h = 5 'to not write T1 T2 T3 T4 a=T1;b=T2, c=T3 , d=T4 '
  4. DT(0) = e * Sin(-4 * _Pi * 2 / c) + f * Sin(-4 * _Pi * 2 / d) + q + g * (1 - Cos(-4 * _Pi * 2 / a)) + h * (1 - Cos(-4 * _Pi * 2 / b))
  5. DT(1) = e * Sin(-3 * _Pi * 2 / c) + f * Sin(-3 * _Pi * 2 / d) + q + g * (1 - Cos(-3 * _Pi * 2 / a)) + h * (1 - Cos(-3 * _Pi * 2 / b))
  6. DT(2) = e * Sin(-2 * _Pi * 2 / c) + f * Sin(-2 * _Pi * 2 / d) + q + g * (1 - Cos(-2 * _Pi * 2 / a)) + h * (1 - Cos(-2 * _Pi * 2 / b))
  7. DT(3) = e * Sin(-1 * _Pi * 2 / c) + f * Sin(-1 * _Pi * 2 / d) + q + g * (1 - Cos(-1 * _Pi * 2 / a)) + h * (1 - Cos(-1 * _Pi * 2 / b))
  8. DT(4) = q
  9. DT(5) = e * Sin(1 * _Pi * 2 / c) + f * Sin(1 * _Pi * 2 / d) + q + g * (1 - Cos(1 * _Pi * 2 / a)) + h * (1 - Cos(1 * _Pi * 2 / b))
  10. DT(6) = e * Sin(2 * _Pi * 2 / c) + f * Sin(2 * _Pi * 2 / d) + q + g * (1 - Cos(2 * _Pi * 2 / a)) + h * (1 - Cos(2 * _Pi * 2 / b))
  11. DT(7) = e * Sin(3 * _Pi * 2 / c) + f * Sin(3 * _Pi * 2 / d) + q + g * (1 - Cos(3 * _Pi * 2 / a)) + h * (1 - Cos(3 * _Pi * 2 / b))
  12. DT(8) = e * Sin(4 * _Pi * 2 / c) + f * Sin(4 * _Pi * 2 / d) + q + g * (1 - Cos(4 * _Pi * 2 / a)) + h * (1 - Cos(4 * _Pi * 2 / b))
  13.  
  14. For I = 1 To 4: DS(I) = (DT(4 + I) - DT(4 - I)) / 2: DC(I) = (DT(4 + I) + DT(4 - I)) / 2 - DT(4): Next I
  15.  
  16. MS = 50
  17. For T3 = 1 To 30 Step 1
  18.     If T3 = 1 Or T3 = 2 Then GoTo 3
  19.     For T4 = T3 + 1 To 30 Step 1
  20.         If T4 = 1 Or T4 = 2 Then GoTo 2
  21.  
  22.         For I = 1 To 4
  23.             S(I, 1) = DS(I)
  24.             S(I, 2) = Sin(2 * 3.141596 * I / T3)
  25.             S(I, 3) = Sin(2 * 3.141596 * I / T4)
  26.             S(I, 4) = 1
  27.         Next I
  28.         For j = 1 To 4
  29.             S(5, j) = S(1, j)
  30.             S(6, j) = S(2, j)
  31.         Next j
  32.         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)
  33.         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)
  34.         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)
  35.         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)
  36.         DETS = -S(4, 4) * D1S + S(1, 4) * D2S - S(2, 4) * D3S + S(3, 4) * D4S
  37.  
  38.         If Abs(DETS) <= MS Then GoTo 1 Else GoTo 2
  39.        1 MS = Abs(DETS)
  40.         TT3 = T3
  41.         TT4 = T4
  42.    2 Next T4
  43. 3 Next T3
  44. Print "TT3="; TT3; "TT4="; TT4
  45.  
  46. ys(4) = AS1 * (1 - Cos(2 * 3.141596 * 4 / TT3)) + AS2 * (1 - Cos(2 * 3.141596 * 4 / TT4))
  47. ys(3) = AS1 * (1 - Cos(2 * 3.141596 * 3 / TT3)) + AS2 * (1 - Cos(2 * 3.141596 * 3 / TT4))
  48. ys(2) = AS1 * (1 - Cos(2 * 3.141596 * 2 / TT3)) + AS2 * (1 - Cos(2 * 3.141596 * 2 / TT4))
  49. ys(1) = AS1 * (1 - Cos(2 * 3.141596 * 1 / TT3)) + AS2 * (1 - Cos(2 * 3.141596 * 1 / TT4))
  50.  
  51. MAS = 50
  52. For AS1 = -10 To 10 Step 1
  53.     For AS2 = -10 To 10 Step 1
  54.         For I = 1 To 4
  55.             AAS(I, 1) = ys(I)
  56.             AAS(I, 2) = Sin(2 * 3.141596 * I / TT3)
  57.             AAS(I, 3) = Sin(2 * 3.141596 * I / TT4)
  58.             AAS(I, 4) = 1
  59.         Next I
  60.         For j = 1 To 4
  61.             AAS(5, j) = AAS(1, j)
  62.             AAS(6, j) = AAS(2, j)
  63.         Next j
  64.         D1AS = 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)
  65.         D2AS = 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)
  66.         D3AS = 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)
  67.         D4AS = 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)
  68.         DETAS = -AAS(4, 4) * D1AS + AAS(1, 4) * D2AS - AAS(2, 4) * D3AS + AAS(3, 4) * D4AS
  69.  
  70.         If Abs(DETAS) <= MAS Then GoTo 4 Else GoTo 5
  71.        4 MAS = Abs(DETAS)
  72.         ASS1 = AS1
  73.         ASS2 = AS2
  74.    5 Next AS2
  75. 6 Next AS1
  76. Print "AS1="; ASS1; "AS2="; ASS2
  77.  
  78. MC = 50
  79. For T1 = 2 To 25 Step 1
  80.     If T1 = 1 Then GoTo 9
  81.     For T2 = T1 + 1 To 25 Step 1
  82.         If T2 = 1 Then GoTo 8
  83.  
  84.         For I = 1 To 4
  85.             C(I, 1) = DC(I)
  86.             C(I, 2) = 1 - Cos(2 * 3.141596 * I / T1)
  87.             C(I, 3) = 1 - Cos(2 * 3.141596 * I / T2)
  88.             C(I, 4) = 1
  89.         Next I
  90.         For j = 1 To 4
  91.             C(5, j) = C(1, j)
  92.             C(6, j) = C(2, j)
  93.         Next j
  94.  
  95.         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)
  96.         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)
  97.         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)
  98.         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)
  99.         DETC = -C(4, 4) * D1C + C(1, 4) * D2C - C(2, 4) * D3C + C(3, 4) * D4C
  100.         If Abs(DETC) <= MC Then GoTo 7 Else GoTo 8
  101.        7 MC = Abs(DETC)
  102.         TT1 = T1
  103.         TT2 = T2
  104.    8 Next T2
  105. 9 Next T1
  106. Print "TT1="; TT1; "TT2="; TT2
  107.  
  108. '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" '
  109. yc(4) = AC1 * (1 - Cos(2 * 3.141596 * 4 / TT1)) + AC2 * (1 - Cos(2 * 3.141596 * 4 / TT2))
  110. yc(3) = AC1 * (1 - Cos(2 * 3.141596 * 3 / TT1)) + AC2 * (1 - Cos(2 * 3.141596 * 3 / TT2))
  111. yc(2) = AC1 * (1 - Cos(2 * 3.141596 * 2 / TT1)) + AC2 * (1 - Cos(2 * 3.141596 * 2 / TT2))
  112. yc(1) = AC1 * (1 - Cos(2 * 3.141596 * 1 / TT1)) + AC2 * (1 - Cos(2 * 3.141596 * 1 / TT2))
  113.  
  114. MAC = 50
  115. For AC1 = -10 To 10 Step 1
  116.     For AC2 = -10 To 10 Step 1
  117.         For I = 1 To 4
  118.             AC(I, 1) = yc(I)
  119.             AC(I, 2) = 1 - Cos(2 * 3.141596 * I / TT1)
  120.             AC(I, 3) = 1 - Cos(2 * 3.141596 * I / TT2)
  121.             AC(I, 4) = 1
  122.         Next I
  123.         For j = 1 To 4
  124.             AC(5, j) = AC(1, j)
  125.             ACS(6, j) = AC(2, j)
  126.         Next j
  127.         D1AC = 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)
  128.         D2AC = 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)
  129.         D3AC = 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)
  130.         D4AC = 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)
  131.         DETAC = -C(4, 4) * D1AC + C(1, 4) * D2AC - C(2, 4) * D3AC + C(3, 4) * D4AC
  132.         If Abs(DETAC) <= MAC Then 'GoTo 4 Else GoTo 5
  133.             MAS = Abs(DETAC)
  134.             ACC1 = AC1
  135.             ACC2 = AC2
  136.         End If
  137.     Next AC2
  138. Next AC1
  139. Print MAS
  140. Print "AC1="; ACC1; "AC2="; ACC2
  141.  
  142.  
  143.  

 
image_2022-03-30_213501.png
« Last Edit: March 30, 2022, 09:35:07 pm by bplus »