Re: Func define [message #19946] |
Sun, 07 May 2000 00:00 |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <3914EBCF.64D4E023@crsa.bu.edu>, Yu Zhang
<yuzhang@crsa.bu.edu> wrote:
> I happen to have a small problem when I tried to do some
> integrations with IDL. For example, I want to use INT_2D or QSIMP to do
> a calculation. But I found out that the "Func" defined in these
> functions
> only have limited parameters (equal to dimension of integral you want to
> do).
> Other coefficiences must be fixed.
> What to do if I need more parameter in the defined function?
> (e.g. I need y=a*x+b and want to change a, b value outside)
> It seems strange that this shouldn't be difficult to consider,
> or I just fail to catch up the spirit of IDL.
A simple way to do this, although not the only way, is to include a
common block in the function.
FUNCTION MY_FUN, x
COMMON MY_FUN_PARAMETERS, a, b
RETURN, a + b*x
END
Regards, Ken Bowman
|
|
|
Re: Func define [message #19947 is a reply to message #19946] |
Sun, 07 May 2000 00:00  |
meron
Messages: 51 Registered: July 1995
|
Member |
|
|
In article <3914EBCF.64D4E023@crsa.bu.edu>, Yu Zhang <yuzhang@crsa.bu.edu> writes:
>
> I happen to have a small problem when I tried to do some
> integrations with IDL. For example, I want to use INT_2D or QSIMP to do
> a calculation. But I found out that the "Func" defined in these
> functions
> only have limited parameters (equal to dimension of integral you want to
> do).
> Other coefficiences must be fixed.
> What to do if I need more parameter in the defined function?
> (e.g. I need y=a*x+b and want to change a, b value outside)
> It seems strange that this shouldn't be difficult to consider,
> or I just fail to catch up the spirit of IDL.
> Thank you very much for your help.
>
> Yu Zhang
>
You could use ROMBERG, from my library. Of course, then, you'll need
other fuctions that ROMBERG is calling, so it'll be best to take the
whole library.
Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
|
|
|