1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Private Sub Command1_Click()
Dim f1(4) As Long
Dim df1() As Long
' Soit la fonction f1(x) = 4X^4 + 3X^3 + 11X^2 -7X -2
' représentée par le tableau f1 = (4,3,11,-7,-2)
f1(0) = 4
f1(1) = 3
f1(2) = 11
f1(3) = -7
f1(4) = -2
df1 = Derivee(f1)
' En sortie, on obtient un tableau représentant la
' dérivée de f1(x) df1 = (16,9,22,-7)
End Sub
Public Function Derivee(t() As Long) As Long()
Dim dt() As Long
Dim PuissanceMax As Long
Dim Puissance As Long
PuissanceMax = UBound(t)
ReDim dt(PuissanceMax - 1)
Puissance = PuissanceMax
For k = LBound(t) To UBound(t) - 1
dt(k) = t(k) * Puissance
Puissance = Puissance - 1
Next k
Derivee = dt
End Function |
Partager