help-octave
[Top][All Lists]

## Re: Integrating a function with many arguments over one varible.

 From: Henry F. Mollet Subject: Re: Integrating a function with many arguments over one varible. Date: Fri, 26 Aug 2005 09:55:19 -0700 User-agent: Microsoft-Entourage/11.1.0.040913

```N.B. QUADL exceeds max_recursion_limit when used with example in Octave. It
works if lower limit of integration is set to 0.001 but takes "forever"

octave:16> function [y]=f(x)
> y= x.*sin(1./x).*sqrt (abs(1-x));
> endfunction
ABNORMAL RETURN FROM DQAGP
ans = 1.9819

error: max_recursion_limit exceeded
error: evaluating binary operator `+' near line 120, column 56

ans = 1.9819

on 8/26/05 9:09 AM, Henry F. Mollet at address@hidden wrote:

> Not sure if this helps but Octave-forge does have quadl.
> Henry
> quadl is the user-defined function from the file
>
>   Lobatto rule.
>
>   Q=QUADL('F',A,B) approximates the integral of
>   F(X) from A to B to machine precision.  'F' is a
>   string containing the name of the function. The
>   function F must return a vector of output values if
>   given a vector of input values.
>
>   Q=QUADL('F',A,B,TOL) integrates to a relative
>   error of TOL.
>
>   end point of the current interval, the interval
>   length, and the partial integral.
>
>   coefficients P1, ... to be passed directly to the
>   function F:  G=F(X,P1,P2,...). To use default values
>   for TOL or TRACE, one may pass the empty matrix ([]).
>
> BIT Vol. 40, No. 1, March 2000, pp. 84--101.
> http://www.inf.ethz.ch/personal/gander/
>
>
>
>
>
> wrote:
>
>> I need to find the integral of f(x, y1, ..., yn), over the variable x,
>> between 2 limits. I read that quadl in Matlab can do it simply, you only
>> have to add the values of the parameters y1, ..., yn at the end, when you
>> use quadl. I tried to do the same with quad in Octave, but it did not
>> work.
>>
>> I can't define "by hand" a function g(x) so that g(x) = f(x, y1, ..., yn),
>> and use quad with g(x), because in fact I need to find the values
>> y1,...,yn that minimize such quadrature along x.
>>
>> Can someone help me?
>>
>> Thank you.
>
>
>
>
> -------------------------------------------------------------
> 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
-------------------------------------------------------------

```