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

Home » Public Forums » archive » Another MPFIT question
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: Another MPFIT question [message #62911 is a reply to message #62830] Mon, 13 October 2008 03:06 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
MichaelT <michael.theusner@googlemail.com> writes:

> Today I discovered MPFIT and I am so excited how well it works (many
> thanks Craig!).
>
> I ran into one problem, however, which I was not able to solve. Maybe,
> there is a simple solution.
> Among all the parameters I have four whose sum must not be larger than
> a certain value:
>
> 0 < c1+c2+c3+c4 < 1.
>
> All four parameters may vary between zero and one which I implemented
> using .limits and .limited. But, how do I implement the additional
> constraint? Any ideas? It may be too obvious for me to see...

The short answer is that MPFIT does not handle complex inequality
constraints, only simple box boundary constraints on each parameter.
Vince's suggestion of re-expressing with different parameters is a
good one, but as you discovered, all the constraints become difficult.

You may be able to cheat. You could append a special data point which
contributes "badness" whenever the parameters go outside of their
desired bounds. For example, if you have 100 data points, you would
append a 101st residual, computed something like this,

big = 100 ; Bigger than your biggest residual
cc = c1+c2+c3+c4 ; Total
cclimits = [0d, 1d] ; Limits on total
toler = 0.001d ; Tolerance on limits
yy = (1-tanh((cc-cclimits(0))/toler))/2 + (1+tanh((cc-cclimits(1))/toler))/2

resid[101] = big*yy

Since MPFIT simply tries to minimize residuals, the presence of one
more residual will be handled just fine. As long as the parameters
are within constraints, the 101st residual contributes nothing, but if
they begin to touch the constraint, resid[101] will start to grow, and
hopefully repel the fitter from going that direction. All untested of
course.

The TANH() functions make an inverse box-car shape, but with smooth
edges. The smoothness is key, otherwise the fitter will rightly fail
due to discontinuities.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: cbmarkwardt+usenet@gmail.com
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: quantum visualizations using IDL
Next Topic: MPFIT

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

Current Time: Mon Dec 01 13:31:08 PST 2025

Total time taken to generate the page: 2.80051 seconds