Mr.Gatsby
09-14-2016, 10:03 PM
Hi,
i am trying to teach my self VBA so i can use it at work to minimize my time while computing data coming in.
i am stuck on writing the program to solve the Expansion of the Maclaurin's Series for sin (x)
This is what i have done so far;
'Dimensionalize'
Dim sum As Double
Dim x As Double
Dim Fact As Integer
Dim N As Integer
'call Values'
x = Range("B4")
N = Range("B3")
sum = 0
Fact = 1
'Math solving stuff'
For i = 1 To N
Fact = Fact * (2 * i - 1)
sum = sum + (((-1) ^ i) * ((x) ^ (2 * i - 1)) / (Fact))
Fact = Fact * 2 * i
Next
Range("b7") = sum
I am lost at what i have done wrong at this point.
i am trying to teach my self VBA so i can use it at work to minimize my time while computing data coming in.
i am stuck on writing the program to solve the Expansion of the Maclaurin's Series for sin (x)
This is what i have done so far;
'Dimensionalize'
Dim sum As Double
Dim x As Double
Dim Fact As Integer
Dim N As Integer
'call Values'
x = Range("B4")
N = Range("B3")
sum = 0
Fact = 1
'Math solving stuff'
For i = 1 To N
Fact = Fact * (2 * i - 1)
sum = sum + (((-1) ^ i) * ((x) ^ (2 * i - 1)) / (Fact))
Fact = Fact * 2 * i
Next
Range("b7") = sum
I am lost at what i have done wrong at this point.