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

Home » Public Forums » archive » Re: Recursive Function Program in IDL
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: Recursive Function Program in IDL [message #46709 is a reply to message #46708] Wed, 14 December 2005 08:36 Go to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
this computes the binomial coefficients recursively
(the numbers showing up in Pascal's triangle)

FUNCTION binomial,n,j

IF n LT j THEN BEGIN
print,'INVALID INPUT IN BINOMIAL'
RETURN,-1
ENDIF

IF j LE 0 THEN RETURN,1

IF j EQ n THEN $
RETURN,1 ELSE $
RETURN,binomial(n-1,j)+binomial(n-1,j-1)

END

Ciao,
Paolo

David Fanning wrote:
> Folks,
>
> Does anyone have a handy recursive function that does something neat?
> Someone is asking, and I don't have time to work on this. He
> (apparently) can't get to the newsgroup.
>
> Thanks,
>
> David
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Fun Writing Books
Next Topic: Re: Polygon Clipping Algo in IDL

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

Current Time: Sat Oct 11 17:20:24 PDT 2025

Total time taken to generate the page: 0.00393 seconds