[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Double integration results in "error: quad: invalid recursive call"
From: |
Geordie McBain |
Subject: |
Re: Double integration results in "error: quad: invalid recursive call" |
Date: |
Thu, 24 Feb 2005 10:34:17 -0500 |
User-agent: |
Mutt/1.5.6+20040907i |
No, I don't know whether you can call quad recursively; however, there
is another way to compute integrals over rectangles in Octave: use
Gaussian quadrature via colloc(). In your example, define
function z = f (x,y)
z = x * y;
endfunction
then:
octave> n=1; [r, A, B, q] = colloc (n); r*=10; r+=0; q*=10; q'*f(r,r')*q
ans = 2500
(which is exact, since the integrand is linear in each of its two
variables; use a bigger n otherwise).
Geordie McBain
www.aeromech.usyd.edu.au/~mcbain
On Wed, Feb 23, 2005 at 04:26:13AM -0600, Timo Steffens wrote:
> Hello,
>
> I am trying to compute a double integration with octave. Since I am
> migrating from "Mathematica", maybe I am thinking wrong. In Mathematica I'd
> do
> NIntegrate[NIntegrate[d1*d2, {d1, 0, 10}], {d2, 0, 10}]
>
>
>
> In Octave I tried the following:
>
> >>function y = myfunc(d1)
> y=d1*d2
> endfunction
> >>function y = firstint(d2)
> [y,ier,nfun,err] = quad('myfunc',0,10)
> endfunction
> >>[result,ier,nfun,err] = quad('firstint',0,10)
> error: quad: invalid recursive call
> error: called from `firstint'
> error: quad: evaluation of user-supplied function failed
>
>
>
> I am using version 2.1.50 for windows. I read in the archives that the
> error for calling quad more than once has been fixed in 2.0.16
>
> I couldn't find information about this behavior in the documentation or the
> mailing list archives...So is it a bug or am I doing something wrong?
>
>
>
> Thanks!
> Timo Steffens
> ----------------------------------------------
> Doctorate Programme Cognitive Science
> Kolpingstr. 7 - Room 01/209 - 49074 Osnabruck
> http://www.cogsci.uos.de/~tsteffen
> phone: +49(0)541/969-4065
> ----------------------------------------------
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------