Re: is this integration possible with mathematica?
- Subject: [mg3106] Re: is this integration possible with mathematica?
- From: Sascha at sunmail.lrz-muenchen.de, Unzicker at lrz.uni-muenchen.de
- Date: 2 Feb 1996 04:23:18 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Universitaet Muenchen (Germany)
- Sender: daemon at wri.com
md88-msa at nada.kth.se (Mickael Salabasis) writes:
>i have encountered a problem in statistics that i cannot seem
>to solve without help.
>i have a line separating the xy-plane. the line is given by the
>following equation:
>f(x,y) : f1(x,y)/f2(x,y) = 1
>where
>f1(x,y) = exp[-k* ((x-m11)^2 + (y-m12)^2)] + exp[-k*((x-m21)^2 + (y-m22)^2)]
>f2(x,y) = exp[-k* ((x-m31)^2 + (y-m32)^2)] + exp[-k*((x-m41)^2 + (y-m42)^2)]
>the m's and k are known constants
>now i want to calculate the (double) integral of f1 in the area ABOVE the
>line defined by f and respectively the integral of f2 for the area BELOWE
>the same line. but i have problems with one of the integrals limits as the
>function f cannot be manipulated to give an expression of the type y=h(x)...
>can it be done and if so how?
>any help appreciated preferrably by email
>with best regards
>majk
I think I had a similar problem.
You should define a function which takes only 0 and 1 as values:
def[x_,y_]:=If[x<y && y>-x,1,0];
And now use NIntegrate:
gr10;
NIntegrate[Exp[-x^2-y^2] def[x,y],{x,-gr,0,gr},
{y,-gr,gr},SingularityDepth->6,MaxRecursion->6,MinRecursion->0,
GaussPoints->100]//Timing
You see, I set some options, because it is still fragile!
If somebody has a good solution, I would be interested as well!
Regards,
Alexander Unzicker
sascha at space.imp.med.uni-muenchen.de