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

Home » Public Forums » archive » Re: alternative to CURVEFIT function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: alternative to CURVEFIT function [message #84348] Thu, 30 May 2013 21:56 Go to next message
Craig Markwardt is currently offline  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 #84349 is a reply to message #84348] Thu, 30 May 2013 21:48 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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
Re: alternative to CURVEFIT function [message #84352 is a reply to message #84349] Thu, 30 May 2013 16:37 Go to previous messageGo to next message
David Fanning is currently offline  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 #84353 is a reply to message #84352] Thu, 30 May 2013 16:05 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
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
Re: alternative to CURVEFIT function [message #84355 is a reply to message #84353] Thu, 30 May 2013 12:25 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Meg writes:

> 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?

http://www.idlcoyote.com/code_tips/installcoyote.php

It will also help if you stick this line of code at the beginning of the
program that contains the reference to MPFIT:

compile_opt strictarr

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 Go to previous messageGo to next message
Meg is currently offline  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 Go to previous messageGo to next message
Russell Ryan is currently offline  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 #84369 is a reply to message #84357] Wed, 29 May 2013 18:39 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
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
Re: alternative to CURVEFIT function [message #84371 is a reply to message #84369] Wed, 29 May 2013 13:15 Go to previous messageGo to next message
Russell Ryan is currently offline  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 #84379 is a reply to message #84371] Wed, 29 May 2013 08:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
fd_luni@mail.com writes:


> 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.

Nearly all the experienced IDL users I know use Craig Markwardt's curve
fitting programs:

http://cow.physics.wisc.edu/~craigm/idl/fitting.html

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 #84440 is a reply to message #84349] Fri, 31 May 2013 05:59 Go to previous message
Russell Ryan is currently offline  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 Go to previous message
Meg is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL problem with ncdf_vardef: can' exit definition mode
Next Topic: The function `CGSFlushWindow' is obsolete

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

Current Time: Wed Oct 08 11:41:39 PDT 2025

Total time taken to generate the page: 0.00431 seconds