Hi Alexander,
Thanks for the fast response. Any assistance with the following would
be appreciated:
(1) Its not clear why the function definition I am using does not
work. According to the Maxima 5.24 manual, paragraph 20.4, the
integrand can be the name of a Maxima function, presumably defined by
the user in a file, for example, integrand.mac
(2) Are there perhaps other Maxima numerical integration functions
that may perform better ?
Thanks very much.
Regards,
Constantine.
On 1/10/12, Alexander Klimov <alserkli at inbox.ru> wrote:
> On Tue, 10 Jan 2012, Constantine Frangos wrote:
>> Any assistance with using the Maxima function quad_qags() in the
>> following application would be appreciated:
>>
>> (1) I am trying to compute the area of regions in the (X,Y)-plane
>> bounded by lines/curves and am using two nested calls to quad_qags()
>> with the integrand being an indicator-type function ind()
>> defined below. It is not clear where the error is ?
>
> The error is due to your definition of ind. You can do it as follows:
>
> (%i1) ind(x,y) := if x*x + y*y <= 1 then 1 else 0$
> (%i2)
> I:quad_qags(quad_qags(ind(x1,x2),x1,-1,1,'epsrel=0.1)[1],x2,-1,1,'epsrel=0.1);
> (%o2) [3.147364455231505, .06760267083066201, 147, 0]
>
> Note that this approch is very roundabout (and takes forever with
> default epsrel). Instead you can
>
> solve(x*x+y*y=1,x);
>
> and use a simple integral:
>
> (%i4) quad_qags(2*sqrt(1-y^2),y,-1,1);
> (%o4) [3.141592653589797, 2.000470900043183e-9, 399, 0]
>
> --
> Regards,
> ASK
>