[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using quad() for multidimensional integration

From: Ted Harding
Subject: Re: Using quad() for multidimensional integration
Date: Thu, 17 Aug 1995 23:21:11 +0200 (BST)

( Re Message From: Vinayak Dutt )
>  I have source code and had a look at it. I am now coming down to the view
> that the problem is due to global variables used in Octave. It seems that
> Octave does not support recursion, as Mike Rilee pointed to me earlier in a
> private e-mail. I myself checked that with a factorial function and it bombed.
> On the other hand, MATLAB does support recusion. But it still fails
> in quad(). So I don't know whats the problem with MATLAB code. But as far
> as I can see Octave's problem stem from no recursion support.

Octave does support recursion. Look at this:--

    octave:78> function  y = fact(x)
    > if x<1, y=gamma(x+1);
    > else y = x.*fact(x-1);
    > end
    > end

    octave:79> fact(5)
    ans = 120
    octave:80> fact(6)
    ans = 720
    octave:81> fact(7)
    ans = 5040
    octave:82> fact(20)
    ans =  2.4329e+18
    octave:83> fact(30)
    ans =  2.6525e+32

Looks OK to me!

Ted.                                    (address@hidden)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]