help-octave
[Top][All Lists]
Advanced

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

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"
compared to QUAD.

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

octave:18> quadl ("f", 0,3)
error: max_recursion_limit exceeded
error: evaluating binary operator `+' near line 120, column 56

octave:20> quadl ("f", 0.001,3)
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
> octave:2> help quadl
> quadl is the user-defined function from the file
> /usr/local/share/octave/2.1.71/site/m/octave-forge/general/quadl.m
> 
> QUADL  Numerically evaluate integral using adaptive
>   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.
> 
>   Q=QUADL('F',A,B,TOL,TRACE) displays the left
>   end point of the current interval, the interval
>   length, and the partial integral.
> 
>   Q=QUADL('F',A,B,TOL,TRACE,P1,P2,...) allows
>   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 ([]).
> 
> W. Gander and W. Gautschi, Adaptive Quadrature - Revisited,
> BIT Vol. 40, No. 1, March 2000, pp. 84--101.
> http://www.inf.ethz.ch/personal/gander/
> 
> 
> 
> 
> 
> on 8/26/05 4:14 AM, address@hidden at address@hidden
> 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
-------------------------------------------------------------



reply via email to

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