Re: alternative to CURVEFIT function [message #84348] |
Thu, 30 May 2013 21:56  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Thursday, May 30, 2013 3:09:20 PM UTC-4, Meg wrote:
> On Wednesday, May 29, 2013 9:39:08 PM UTC-4, Craig Markwardt wrote:
>
> I'm trying to learn more about MPFIT too. I don't understand how to use the routines once I have downloaded the .pro files (new programer). I'm just not sure where to put the files so that IDL reads MPFITFUN as a routine and not a variable. Can you point me to a resource that will help?
David provides good installation advice.
Once you have MPFIT installed, then try going through my tutorial.
http://cow.physics.wisc.edu/~craigm/idl/mpfittut.html
Craig
|
|
|
|
Re: alternative to CURVEFIT function [message #84352 is a reply to message #84349] |
Thu, 30 May 2013 16:37   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
wlandsman writes:
> On Thursday, May 30, 2013 2:47:59 PM UTC-4, rr...@stsci.edu wrote:
>>
>>
>>
>> BTW, Craig. What does MPFIT stand for? I mean, I can guess about what FIT is... But MP?
>>
>
> I'm guessing MP stands for MinPack -- http://www.netlib.org/minpack/ - which is the source of the original FORTRAN algorithms. And I'm guessing that MinPack stands for minimization package. --Wayne
Doh, I had this all lined up for this years IDL Expert Programmer's
Association (IEPA) test question:
http://www.idlcoyote.com/misc_tips/iepa_test.html
Back to the drawing board. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: alternative to CURVEFIT function [message #84356 is a reply to message #84355] |
Thu, 30 May 2013 12:09   |
Meg
Messages: 7 Registered: May 2013
|
Junior Member |
|
|
On Wednesday, May 29, 2013 9:39:08 PM UTC-4, Craig Markwardt wrote:
> On Wednesday, May 29, 2013 11:19:27 AM UTC-4, fd_...@mail.com wrote:
>
>> I was wondering if anyone knows an alternative function of CURVEFIT. If I am not mistaken the CURVEFIT uses the Levenberg-Marquart algorithm. I need to use a different algorithm which provides a numerical solution to the problem of minimising a function, generally non-linear.
>
>>
>
>> Nelder–Mead method and Newton-Raphson are some choices but I was wondering if there is a function in IDL like the CURVEFIT.
>
>
>
> Adding to what the other posters said...
>
>
>
> If you can any way express your function as the sum of squared residuals, then you should try to use the MPFIT family of functions. It is far more stable than CURVEFIT.
>
>
>
> Note that you can sometimes bend the rules. If your optimization function is the sum of *somethings*, then often you can rewrite the somethings as (somethings elses)^2. As long as (something else) is signed, you can use MPFIT.
>
>
>
> If you really need general function minimization, then yes you can try my TNMIN. If your user function is smooth then it will find a minimum with a Newton-type method.
>
>
>
> Craig
>
> http://cow.physics.wisc.edu/~craigm/idl/fitting.html
Hi,
I'm trying to learn more about MPFIT too. I don't understand how to use the routines once I have downloaded the .pro files (new programer). I'm just not sure where to put the files so that IDL reads MPFITFUN as a routine and not a variable. Can you point me to a resource that will help?
- Meg
|
|
|
Re: alternative to CURVEFIT function [message #84357 is a reply to message #84356] |
Thu, 30 May 2013 11:47   |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
On Wednesday, May 29, 2013 9:39:08 PM UTC-4, Craig Markwardt wrote:
> On Wednesday, May 29, 2013 11:19:27 AM UTC-4, fd_...@mail.com wrote:
>
>> I was wondering if anyone knows an alternative function of CURVEFIT. If I am not mistaken the CURVEFIT uses the Levenberg-Marquart algorithm. I need to use a different algorithm which provides a numerical solution to the problem of minimising a function, generally non-linear.
>
>>
>
>> Nelder–Mead method and Newton-Raphson are some choices but I was wondering if there is a function in IDL like the CURVEFIT.
>
>
>
> Adding to what the other posters said...
>
>
>
> If you can any way express your function as the sum of squared residuals, then you should try to use the MPFIT family of functions. It is far more stable than CURVEFIT.
>
>
>
> Note that you can sometimes bend the rules. If your optimization function is the sum of *somethings*, then often you can rewrite the somethings as (somethings elses)^2. As long as (something else) is signed, you can use MPFIT.
>
>
>
> If you really need general function minimization, then yes you can try my TNMIN. If your user function is smooth then it will find a minimum with a Newton-type method.
>
>
>
> Craig
>
> http://cow.physics.wisc.edu/~craigm/idl/fitting.html
BTW, Craig. What does MPFIT stand for? I mean, I can guess about what FIT is... But MP?
R
|
|
|
|
Re: alternative to CURVEFIT function [message #84371 is a reply to message #84369] |
Wed, 29 May 2013 13:15   |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
Well, according to the IDL documentation, curvefit uses the gradient-expansion algorithm --- whereas lmfit uses Levenburg-marquardt. I suppose these could be the same algorithm, but it seems odd. The Markwardt stuff that David pointed you to is two different algorithms: Levenburg-marquardt and truncated newton (i'm fairly sure these are actually different).
Now, the Nelder-Mead is just the amoeba algorithm --- as coded in IDL by ... amoeba.pro.
Now, there are others in IDL as well: dfpmin, powell, and a few others (which assume linearity).
Can you compute the derivative of the function to minimize analytically? The answer to that will dictate what options you have.
Finally, I agree with David. the MPFIT from Markwardt is probably the best all-purpose thing in IDL.
Russell
On Wednesday, May 29, 2013 11:19:27 AM UTC-4, fd_...@mail.com wrote:
> Hi all
>
>
>
> I was wondering if anyone knows an alternative function of CURVEFIT. If I am not mistaken the CURVEFIT uses the Levenberg-Marquart algorithm. I need to use a different algorithm which provides a numerical solution to the problem of minimising a function, generally non-linear.
>
> Nelder–Mead method and Newton-Raphson are some choices but I was wondering if there is a function in IDL like the CURVEFIT.
>
>
>
> With Thanks
>
> M
|
|
|
|
Re: alternative to CURVEFIT function [message #84440 is a reply to message #84349] |
Fri, 31 May 2013 05:59  |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
On Friday, May 31, 2013 12:48:34 AM UTC-4, Craig Markwardt wrote:
> On Thursday, May 30, 2013 7:05:43 PM UTC-4, wlandsman wrote:
>
>> On Thursday, May 30, 2013 2:47:59 PM UTC-4, rr...@stsci.edu wrote:
>
>> I'm guessing MP stands for MinPack -- http://www.netlib.org/minpack/ - which is the source of the original FORTRAN algorithms. And I'm guessing that MinPack stands for minimization package. --Wayne
>
>
>
> Ding ding! Right. You win a free MPfit MP3 player from the year 2000.
>
>
>
> Craig
GRRR... I should've been able to guess that....
|
|
|
Re: alternative to CURVEFIT function [message #84738 is a reply to message #84369] |
Thu, 30 May 2013 12:05  |
Meg
Messages: 7 Registered: May 2013
|
Junior Member |
|
|
On Wednesday, May 29, 2013 9:39:08 PM UTC-4, Craig Markwardt wrote:
> On Wednesday, May 29, 2013 11:19:27 AM UTC-4, fd_...@mail.com wrote:
>
>> I was wondering if anyone knows an alternative function of CURVEFIT. If I am not mistaken the CURVEFIT uses the Levenberg-Marquart algorithm. I need to use a different algorithm which provides a numerical solution to the problem of minimising a function, generally non-linear.
>
>>
>
>> Nelder–Mead method and Newton-Raphson are some choices but I was wondering if there is a function in IDL like the CURVEFIT.
>
>
>
> Adding to what the other posters said...
>
>
>
> If you can any way express your function as the sum of squared residuals, then you should try to use the MPFIT family of functions. It is far more stable than CURVEFIT.
>
>
>
> Note that you can sometimes bend the rules. If your optimization function is the sum of *somethings*, then often you can rewrite the somethings as (somethings elses)^2. As long as (something else) is signed, you can use MPFIT.
>
>
>
> If you really need general function minimization, then yes you can try my TNMIN. If your user function is smooth then it will find a minimum with a Newton-type method.
>
>
>
> Craig
>
> http://cow.physics.wisc.edu/~craigm/idl/fitting.html
Hi,
I'm trying to learn more about MPFIT too. I don't understand how to use the routines once I have downloaded the .pro files (new programer). Can't you point me to a resource that will help?
- Meg
|
|
|