Solving systems of eqs involving Integrations over product of
- To: mathgroup at smc.vnet.net
- Subject: [mg93118] Solving systems of eqs involving Integrations over product of
- From: er <erwann.rogard at gmail.com>
- Date: Mon, 27 Oct 2008 03:12:39 -0500 (EST)
hi,
here's my integration function:
IntegrateOverIndependentDistributions/:
IntegrateOverIndependentDistributions::usage="IntegrateOverIndependentDistributions[fun,
{d1,d2,...},method:NIntegrate]
returns method[fun[x[1],x[2],...]PDF[d1,x1]PDF[d2,x2]...,{x1,-inf,inf},
{x2,-inf,inf}]";
IntegrateOverIndependentDistributions[expr_, dists_,method_:
NIntegrate] :=
With[{len = Length[dists]},
Module[{x},
With[{vars = x /@ Range[1, len]},
With[{integrand =
Times[expr @@ vars, Times @@ MapThread[PDF, {dists,
vars}]],
ranges= With[{lst={#, -\[Infinity], \[Infinity]} & /@
vars},Sequence @@ lst]
},
method[integrand, ranges]
]
]
]
];
I now have an integrand of the form say f[g1_][x1_,x2_]=...
So I define F[g1_]:=IntegrateOverIndependentDistributions[f[g1],
{NormalDistribution[0,1],NormalDistribution[0,1]}];
and do
FindRoot[
{
F[g1] == 0.0
},
{{g1, -10, 10}}
] ;
but i get the error message:
FindRoot::"nlnum"
"The function value {NIntegrate[...],{($$24632, $$24657, $
$24658\)}] is not a list of numbers with dimensions {1} at {\[Gamma]1}
= {10.}.
It seems that $$24632 is not what I should have, I should have g1...
By the way evaluation f[g1] on a grid works...
Please help.
Thanks.