Sub making_f()
x = Worksheets(2).Cells(3, 2).Value
'this is the input for x
n = Worksheets(2).Cells(1, 2).Value
'this is the degree of the polynomial
Worksheets(2).Cells(8, 2) = Worksheets(2).Cells(7, 2).Value
'this is dropping down the constant term to the next row
For m = 1 To n
Worksheets(2).Cells(8, 2 + m) = Worksheets(2).Cells(7, m + 2) * f_1(m, x)
Next
'this is inputting the values of constant*x^m in the next row
Worksheets(2).Cells(9, 2) = Worksheets(2).Cells(7, 2).Value
'this is dropping the constant term down again as I don't know how to sum efficiently in vba I do it iteratively.
For m = 1 To n
Worksheets(2).Cells(9, m + 2) = Worksheets(2).Cells(9, m + 1).Value + Worksheets(2).Cells(8, m + 2).Value
'this iterates the summation
Next
Worksheets(2).Cells(9, 1) = Worksheets(2).Cells(9, n + 2).Value
'this gives me the value of f(x)
End Sub
Bookmarks