comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: TNMIN limits
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: TNMIN limits [message #57116 is a reply to message #57096] Mon, 03 December 2007 06:36 Go to previous messageGo to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
> Hi Brian;
> Would you please specify this method with a simple example in IDL? I'm
> interesting in this method but I can't make the head and tail of it.

Sure,

the example in help is not to bad either, I use it every time I go to
use the routine.

save this toy example as amoeba_test.pro then just .run amoeba_test
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; .run amoeba_test

FUNCTION min_me, P
;; function is the negative of the dist function
RETURN, -(dist(100))[p[0],p[1]]
;; probably should have put in some error checking as this will error
if p<0 or p>99
END

; we start at P0
p0 = [67,45] ; random guess
;; you have to play with scale, it is in some sense the step size that
;; the amoeba uses, the smaller the closer to the answer but the
;; bigger chance of getting lost and taking forever
ans = amoeba(1e-5, p0=p0, scale=5, FUNCTION_name='min_me')
print, ans, -(dist(100))[ans[0], ans[1]]
;; lets check the answer
print, min(-dist(100))
;; which should be the right answer
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;

IDL> .run amoeba_test
% Compiled module: MIN_ME.
% Compiled module: $MAIN$.
50.4927 50.1697
-70.7107
-70.7107

So we get the right answer. Great routine.

I will probably write something up and post it along with the
description from Charles Kankelborg (assuming he gives me the ok) on
my idl tips site, not as good as David Fanning's or Michael Galloy's
but just trying to be mathy and let them do coding and especially
graphics.
http://people.bu.edu/balarsen/Home/IDL/IDL.html

Ask away if you have any more issues, I have a lot of experience in
beating this routine into submission. Forcing limits on the input
variables happens in the function, you need to do something like if
the value to too big or too small then return a large number so the
amoeba will step away from that.



Cheers,

Brian

------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 6.4 seg-faults when drawing (Solaris-8)
Next Topic: TNMIN limits

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:56:52 PDT 2025

Total time taken to generate the page: 0.32307 seconds