50g group photo

Yahoo Groups archive

50g

Archive for 50g.

Index last updated: 2026-03-30 00:59 UTC

Message

solving numerically within a program

2009-03-18 by David Bush

I want to numerically solve the following equation for N within a program, knowing D:

D = LOG(2*PI*N)/2 + N*LOG(N/e)

When I use the numerical solve menu, I get an answer for D=100000 within 3 seconds: N=25205.9815429

I tried the SOLVE command instead, with flag 105 set (approximate mode on) and flag 3 set (numerical results). I got "SOLVE Error: Not reducible to a rational expression"

If I use the MSLV command within a program with a bad initial guess of N=10, the program takes several minutes to iterate its way to the correct answer.

So, it looks like MSLV is the only way I can solve within a program, and I have to provide a decent initial guess if I want to save a lot of time. I could bypass any solve related command by iterating through possible values of N myself until I find a sufficient value, but this also takes time.

The numeric solve menu didn't need an initial guess, and it found a solution quickly. Is there some way to find a solution quickly within a program without a good initial guess?

Attachments