1
$\begingroup$

dear All!

I'm a beginner in Mathematica coding, and now trying to find out the following (numerical) integration using Mathematica: \begin{align} g(\mu) := \int_0^1 \sum_{i=1}^{K} [x f(0.05+0.95x; \mu_i) \prod_{j \neq i} F(x; \mu_j)] dx \end{align} where $\mu = (\mu_1, ... , \mu_K)$ is a $k$-vector, and $F(x; \theta), f(x; \theta)$ are given functions, i.e. \begin{align} & F(x; \theta) = \Phi[\theta - \Phi^{-1}(1 - \frac{x}{2})]; \\ & f(x; \theta) = e^{-\frac{\theta^2}{2}} \cosh(\theta \Phi^{-1}(1 - \frac{x}{2})) \end{align} The Mathematica code for the two functions are:

F[x_, \[Theta]_] := 1 - CDF[NormalDistribution[0, 1], InverseCDF[NormalDistribution[0, 1],  1 - x/2] - \[Theta]] + CDF[NormalDistribution[0,1], -InverseCDF[NormalDistribution[0, 1],  1 - x/2] - \[Theta]]
f[x_, \[Theta]_] := Exp[-\[Theta]^2/2] * Cosh[\[Theta] * InverseCDF[NormalDistribution[0, 1], 1 - x/2]] 

I know how to product all elements in the list using Times, but what is the summation of production like in the integral? Thanks so much!!

$\endgroup$

1 Answer 1

4
$\begingroup$
k = 5;
Integrate[
 Sum[x*f[0.05 + 0.95 x, μ[i]]*
   Product[F[x, μ[j]], {j, Complement[Range[k], {i}]}], {i, 
   k}], {x, 0, 1}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks so much!!! But how do you define vector here? I claim in Mathematica as "\mu = {1, 2, 3, 4, 5}", but cannot extract element using "\mu[i]". $\endgroup$
    – 0o0o0o0
    Oct 15, 2022 at 3:02
  • $\begingroup$ See the documentation of Part. $\endgroup$
    – user293787
    Oct 15, 2022 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.