I would like to compute the following function of two independent random variables:

     1 - Exp[-ρ ((K (1 + s*K^(β - 1)*ϵ) - c*s*K))], { 
      c \[Distributed] NormalDistribution[Subscript[μ, c], Subscript[σ, c]],
      ϵ \[Distributed] NormalDistribution[Subscript[μ, r], Subscript[σ, r]]}]

However, it seems Mathematica can not compute it.


What version are you using? It works just fine on my 11.3 installation:

In[2]:= Expectation[1-Exp[-\[Rho] ((K (1+s*K^(\[Beta]-1)*\[Epsilon])-c*s*K))],{c\[Distributed]NormalDistribution[Subscript[\[Mu],c],Subscript[\[Sigma],c]],\[Epsilon]\[Distributed]NormalDistribution[Subscript[\[Mu],r],Subscript[\[Sigma],r]]}]

Out[2]= 1-E^(1/2 [Rho] (-2 K+2 K s Subscript[[Mu], c]-2 K^[Beta] s Subscript[[Mu], r]+K^2 s^2 [Rho] Subsuperscript[[Sigma], c, 2]+K^(2 [Beta]) s^2 [Rho] Subsuperscript[[Sigma], r, 2]))

enter image description here

Some general pointers though:

  1. Specify Assumptions if symbolic computations are failing. Very often Mathematica needs to know that certain variables are real or positive rather than complex-valued
  2. Do not use Subscript for variables/parameters in symbolic computations. Sometimes it works (like it did just now), but often enough it won't and it's just not worth the bother. It's better to stick with normal symbols most of the time. See also: Can we use letter with a subscript as a variable in Mathematica?
  • 1
    $\begingroup$ It doesn't work as is on version 10.4. But if one follows your good advice about avoiding Subscript, it works fine on 10.4. $\endgroup$
    – JimB
    Apr 3 '19 at 14:25
  • $\begingroup$ Most thanks Sjoerd Smit and JimB for your very helpful advices!!! Indeed, it works perfectly w/o Subscript! $\endgroup$
    – user63801
    Apr 4 '19 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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