Re: integral inside an integral
- To: mathgroup at smc.vnet.net
- Subject: [mg113611] Re: integral inside an integral
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 4 Nov 2010 04:01:39 -0500 (EST)
In your definition of h, alpha must be a pattern, and since you are using numerical techniques alpha should be restricted to a numeric value.
Clear[h, h2]
k[x_] := Exp[-x^2/3]
h[f_, g_, alpha_?NumericQ] :=
NIntegrate[f[alpha - x]*k[x]/
NIntegrate[g[alpha - x - y]*k[y],
{y, -Infinity, Infinity}],
{x, -Infinity, Infinity}]
h[Exp[-3 #^2/4] &, Exp[-5 #^2/6] &, 6] //
Quiet
0.00081979
Checking this:
h2[f_, g_, alpha_] :=
Integrate[f[alpha - x]*k[x]/
Integrate[g[alpha - x - y]*k[y],
{y, -Infinity, Infinity}],
{x, -Infinity, Infinity}]
h2[Exp[-3 #^2/4] &, Exp[-5 #^2/6] &, 6]
(7*Sqrt[2/71])/E^(516/71)
% // N
0.00081979
Bob Hanlon
---- "Hagwood wrote:
=============
Does anyone know how to make the following work using pure functions in Mathematica? Given two functions f and g compute and for a fixed k[x]
h[f_,g_,alpha]:=NIntegrate[f[alpha-x]*k[x]/NIntegrate[g[alpha-x-y]*k[y],{y,-Infinity,Infinity}],{x,-Infinity,Infinity}]
I want to put arbitrary functions f and g into h and get an answer.
Charles