wongccw

04-23-2007, 04:43 AM

Hello, I am new to this forum and I have an urgent problem to be solved. I hope someone here can help me out in writing a VBA While Loop on the Sine x function of the Taylor Series.

the function that i need to write is something like this:

h ttp://upload.wikimedia.org/math/5/d/3/5d32785481dec2be0c115f510f164dd1.png

So far I have written a few lines. And my program is like the following:

Function sum()

Dim x() As Double

Dim sine As Double

Dim I As Integer

Dim cell As Range

Dim ValRange As Range

x() = Cells(1, 1).Value

Cells(1, 1).Value = x(1)

Cells(2, 1).Value = x(2)

Cells(3, 1).Value = x(3)

Cells(4, 1).Value = x(4)

Cells(5, 1).Value = x(5)

Cells(6, 1).Value = x(6)

sine = x(I)

AddIt = x(I)

Fact = Fact + 2

While AddIt < 0.00000001

sine = AddIt * x(I) * x(I) / Fact / Fact - 1

AddIt = Abs(AddIt) - 1

x(I + 1) = x(I)

Wend

End Function

my function is not working

i need URGENT HELP... Please help me><

thanks

the function that i need to write is something like this:

h ttp://upload.wikimedia.org/math/5/d/3/5d32785481dec2be0c115f510f164dd1.png

So far I have written a few lines. And my program is like the following:

Function sum()

Dim x() As Double

Dim sine As Double

Dim I As Integer

Dim cell As Range

Dim ValRange As Range

x() = Cells(1, 1).Value

Cells(1, 1).Value = x(1)

Cells(2, 1).Value = x(2)

Cells(3, 1).Value = x(3)

Cells(4, 1).Value = x(4)

Cells(5, 1).Value = x(5)

Cells(6, 1).Value = x(6)

sine = x(I)

AddIt = x(I)

Fact = Fact + 2

While AddIt < 0.00000001

sine = AddIt * x(I) * x(I) / Fact / Fact - 1

AddIt = Abs(AddIt) - 1

x(I + 1) = x(I)

Wend

End Function

my function is not working

i need URGENT HELP... Please help me><

thanks