Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Problem solver call from vb6

It's been a while that Dana Delouis mailed me with the perfect
solution, but I forgot to put it on the board. But as people would
say "better late than never." :-)

Mail from Dana DeLouis:

Hi. If interested, here are just a couple of small ideas for your
code.
It seems to work find. However, it's not designed to be fancy to
catch the
errors when you take (-x)^(-2/3).
One idea here is to factor out a common term from the numerator and
denominator.

Sub TestIt()
Dim B2, B4, B13, B14
Dim Num, Den, de
Dim k As Double

Dim t As Double 'Temporary Variable
Dim N As Long ' Count of Loops
Dim C As Collection 'Check for Duplicates

Set C = New Collection

B2 = 0.28
B4 = 6.65
B13 = 4.25
B14 = 0.25
k = -(2 / 3)
de = 0.00001 'Or 10

On Error Resume Next
Do
N = N + 1
t = 2 * B14 * (de / (B13 - 2 * B14)) ^ k
Num = 2 * B2 - B4 + de + t
Den = 1 + (k * t) / de
de = de - (Num / Den)
C.Add de, CStr(de)
Debug.Print N; FormatNumber(de, 15)
Loop While Err.Number = 0 And N <= 30

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having Solver Call a macro for each iteration Andrew Harris Excel Discussion (Misc queries) 2 March 8th 10 04:27 AM
Interesting Solver problem (Solver encounters an error) MrShorty Excel Discussion (Misc queries) 3 December 22nd 05 10:52 PM
how can call up solver with a button Muzhik Excel Programming 2 August 15th 05 02:03 PM
is there anyway to call the Solver add-in as a function? Tushar Mehta Excel Programming 0 September 2nd 04 04:07 PM
is there anyway to call the Solver add-in as a function? Jerry W. Lewis Excel Programming 0 September 2nd 04 01:21 PM


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"