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

Home » Public Forums » archive » Re: Solving nonlinear equations
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: Solving nonlinear equations [message #36827] Sun, 02 November 2003 10:19
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
trouble writes:

> </shameless plug for own code>
>
> Gents, please. We all know you're really clever.

Alright, I'll rise to this bait. Here are five
reasons I prefer to have the experts on this
newsgroup blow their own horns:

1. The programs they tout are (nearly always)
better than comparable routines that come
with IDL. This is especially so with Craig's
mathematical routines, IMHO.

2. Their programs almost always address shortcomings
or weaknesses in IDL routines. For example, Liam's
IMGDISP is a much better image display routine
than TV, for all kinds of reasons (you don't have
to know the decomposed setting of your device,
it works identically on your display and in PostScript,
it works with !P.MULTI, etc., etc.).

3. The advice is (almost always) motivated by
experience, not hype. I've never seen an
acknowledged IDL expert advocate the GUI Builder
here, for example. Even when the advice *is*
motivated by self-aggrandizement (I've noticed
some of this in my own posts, particularly), the
advice is always free and it is easy to tell when
it is worth as much as it costs.

4. The experts don't *have* to hang out here.
Lord knows they are not getting rich answering
all the questions they answer. Putting up with
the occasional shameless plug is a small price
to pay for having them here and available
to us. I wish they got *more* acknowledgement
for their significant contributions, not less.
(And I want to mention especially how much I
appreciate Karl Shultz's contributions to this
newsgroup. I wish we had more of this from RSI.)

5. Sometimes you have to say the same thing over
and over again before people hear it. I offer the
10 million Google references to the phrase
"Device, Decomposed=0" as evidence.

And I offer one bonus reason. The IDL newsgroup
experts really *are* clever. New and experienced
users alike can learn more about IDL by following
the links to their (possibly over-hyped) programs then
they will ever learn by reading the iTools User Guide.

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Solving nonlinear equations [message #36832 is a reply to message #36827] Sat, 01 November 2003 22:01 Go to previous message
the_cacc is currently offline  the_cacc
Messages: 104
Registered: October 2001
Senior Member
</shameless plug for own code>

Gents, please. We all know you're really clever.

<On Topic>

The IDL function amoeba is pretty handy.

</On Topic>
Re: Solving nonlinear equations [message #36835 is a reply to message #36832] Sat, 01 November 2003 16:48 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <3FA431FE.9050807@mit.edu>, Thierry Savin <savin@mit.edu> writes:
> Hi all,
>
> Is it possible to create a function called let's say "solvef":
>
> IDL> x=solvef(a,'f')
>
> that returns x the solution of f(x,a)=0 ?
>
Yes.

> Thanks for any suggestion.
>
Check out the function ROOT in my library (library is called MIDL,
you'll find it on the RSI users contributions page). For cases where
the function is just given as a set ov values (no analytical
representation) you may consider SPLINROOT, in the same library.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: Solving nonlinear equations [message #36836 is a reply to message #36835] Sat, 01 November 2003 15:03 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Thierry Savin <savin@mit.edu> writes:
> Hi all,
>
> Is it possible to create a function called let's say "solvef":
>
> IDL> x=solvef(a,'f')
>
> that returns x the solution of f(x,a)=0 ?

Either MPFIT or TNMIN from my web page can do this kind of job. Both
are designed to be function minimizers. MPFIT will minimize the
square of any function [ in fact the sum of squares of N functions ].
Although people don't normally think of it as so, MPFIT is actually an
equation solver, in addition to a least squares solver.

Your set of fixed parameters, A, would normally passed using
FUNCTARGS. Your notation of X (the varying parameter) and A (the
fixed parameters) are actually reversed from the notation used in
MPFIT or MPFITFUN, where P is the varying parameter and X are the
fixed parameters. Example:

function fx, a, x
return, a(0)+a(1)*x+a(2)*x^2
end


print, mpfitfun('fx', [-2d,10d,4d], [0,0,0], 10, [0d], /quiet)
0.18614066

[ Not sure why an uncertainty estimate of 10 is needed though, hmmm. ]
Or, one can define a new function which is the square of the desired
function, and use TNMIN:

function fffsq, x, a=a
return, ( a(0)+a(1)*x+a(2)*x^2)^2
end

print, tnmin('fffsq', [0d], functargs={a:[-2d,10d,4d]},/autoderiv, /quiet)
0.18614066


Both of these numbers are close to the exact value.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: On G4 Mac Re: path_sep() or where() crashing my idlde?
Next Topic: Re: using VOXEL_PROJ to obtain "thick slice"

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

Current Time: Wed Oct 08 14:56:05 PDT 2025

Total time taken to generate the page: 0.00372 seconds