View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
xyfix xyfix is offline
external usenet poster
 
Posts: 10
Default Problem solver call from vb6

I tried to apply the newton-Raphson method (solver is not working OK)
that is described by Dan DeLouis for another equation, but I can't
seem to get it right. The Newton-Raphson method tells us that x1 =
x0 - f(x0)/ f '(x0). The derivative of f(x) with respect to x is the
problem here. Here is what i got so far and can anybody say if the Den
is OK

Dim B2, B4, B13, B14
Dim Num, Den
Dim Q As Long
Dim K

B13 = Sheets("InputValues").Cells(13, 2)
B14 = Sheets("InputValues").Cells(14, 2)
B4 = Sheets("InputValues").Cells(4, 2)
B2 = Sheets("InputValues").Cells(2, 2)
K = -(2/3)
de = 0.00001

For Q = 1 To 12

Num = de + (2 * B14) * (de / (B13 - 2 * B14)) ^ (K) - (B4
- 2 * B2)

Den = 1 + (2 * B14 * K * (de / (B13 - 2 * B14)) ^ (K -
1)) /(B13 - 2 * B14)

de = de - (Num / Den)

Next Q