0

Hi I'm completely new to using VB in excel, but could someone help me fix my program. I'm supposed to find the roots of the equation denoted as func using the newton raphson method. Currently I am not getting the correct roots and the range of values which can be input are very limited. Could someone help on how to fix this? Thanks!

```
Option Explicit
Function newton(guess)
Dim func As Double, deriv As Double, i As Double, x2 As Double, x As Double, dif As Double
x = guess
For i = 0 To 1000
func = x ^ 2 * Sin(x) + x ^ 3 * Exp(x) - x * Cos(x) - 7
deriv = (x ^ 2 - 1) * Cos(x) + 3 * x * Sin(x) + (x ^ 3 + 3 * x ^ 2) * Exp(x)
x2 = (x - func) / deriv
dif = x2 - x
x = x2
If Abs(dif) < 0.001 Then i = 1000
Next i
newton = x
End Function
```