3
$\begingroup$

I need to solve the following function:

$$ h(z) = \sum^{40}_{k=0} \frac{k \, p(k)}{z- k \, h(z)} $$ where $p(k)$ is a probability distribution (in this case binomial with n = 40). Note that $h(z)$ is also inside the sum and also that $z$ is inside. I've been struggling to solve this function. I'm sortof interested in the case in which this sum is solvable but I am sure of certain cases in which the expression is exactly solvable. Also Mathematically one can deduce that the solution will have an imaginary part. An example could be for a binomial distribution as following. I think I didn't define well here that h[z] is actually a function.

p[n_, k, pkans_] := Binomial[n - 1, k]*pkans^k*(1 - pkans)^(n - 1 - k);
s = Solve[h[z] == Sum[(k*p[40, k, 0.6])/(z - k*h[z]), {k, 0, 40}],h[z]]

My question would be how I could try to use Mathematica to solve this equation? I am not sure how to use the solve command for functions. Also I would like to extend solving these equations to other probability distributions and to continuous distributions as well.

Regards,

Note further that $h(z)$ is in the denominator dependent on $z$ as well as $h(z)$ .

$\endgroup$
5
  • $\begingroup$ Try to give a code so that other users can focus their time on solving the hard parts, rather than typing in the code! Also, you need to give the definition of your probability distribution function and the h(z) function, Otherwise, your question is off-topic and you can just refer to the help pages for a general case. $\endgroup$
    – MathX
    Commented May 11, 2016 at 17:22
  • $\begingroup$ {x, 0, 40} should be {k, 0, 40}? $\endgroup$
    – kglr
    Commented May 11, 2016 at 17:45
  • 1
    $\begingroup$ @MathX Hi, thanks. I've edited the question. I wasn't able to find a general case example in the Mathematica documentation guide. $\endgroup$ Commented May 11, 2016 at 17:45
  • $\begingroup$ @kglr I'm sorry. I added an example where the case was actually a discrete distribution. I've edited the question for a sum. $\endgroup$ Commented May 11, 2016 at 17:48
  • $\begingroup$ Thanks for the edit. Actually, now that I understand better, I like your question. $\endgroup$
    – MathX
    Commented May 11, 2016 at 18:13

1 Answer 1

2
$\begingroup$

$$ h(z) =\sum _{k=0}^n \frac{k\, p(k)}{z-k\, h (z)}$$

Observe that the rhs of the equality is the expectation of the random variable $u = k/ (z- k\, h(z))$, where $k$ is a Binomial random variable with parameters $n$ and $ρ$. So we can try TransformedDistribution and Expectation or NExpectation to see if we get anything useful:

n = 10;
ρ = 6/10;

tdist = TransformedDistribution[k/(z - k h[z]), 
           Distributed[k, BinomialDistribution[n, ρ]]];

rhs = Simplify[Expectation[u, Distributed[u, tdist]]]

Mathematica graphics

sols = h[z] /. FullSimplify[Solve[h[z] == rhs, h[z], Reals], Assumptions->{z > 0}]

Mathematica graphics

Plot[Evaluate[sols], {z, 0, 10}]

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ Wow thank you very much. I think it works. Just as a short follow up question. I am only interested in solutions with an imaginary part (I removed the reals part and that z>0 and still got fine solutions). I now have the plots of these, but how can you select the solutions with an imaginary part from the sols? I am very unifamiliar with the notation of # and Im[sols] doesn't seem to do anything $\endgroup$ Commented May 11, 2016 at 21:34
  • $\begingroup$ @user1792605, does this work: Plot[Evaluate[Im /@ sols], {z, 0, 10}]? $\endgroup$
    – kglr
    Commented May 11, 2016 at 21:43
  • $\begingroup$ Yeah that definitely works! Only I don't know how to get the exact formula for $h(z)$. But I guess you can't really write it as a formula of course. $\endgroup$ Commented May 11, 2016 at 21:44

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.