title: Maximum Likelihood function using Sympy returns empty list
body: <p>I wanted to create a function that would return estimator calculated by Maximum Likelihood Function. The function I made is below:</p>
  <pre><code>def Maximum_Likelihood(param, pmf):
      
      i = symbols('i', positive=True)
      n = symbols('n', positive=True)
      
      Likelihood_function = Product(pmf, (i, 1, n)) 
      # calculate partial derivative for parameter (p for Bernoulli)
      deriv = diff(Likelihood_function, param) 
      equation_to_solve = Eq(deriv,0) # equate with 0
      
      # solve above equation and return parameter (p for Bernoulli)
      return solve(equation_to_solve, param) 
  </code></pre>
  <p><em>Param</em> means parameter for which I want to know estimator and <em>pmf</em> is a probability mass function.</p>
  <p>And for example, I want to get an estimator for parameter <em>p</em> in Bernoulli distribution.
  How the Maximum Likelihood should look is:</p>
  <p><a href="https://i.stack.imgur.com/AZdIO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AZdIO.jpg" alt="Maximum Likelihood" /></a></p>
  <p>My code.
  Imports:</p>
  <pre><code>import numpy as np
  import sympy as sym
  
  from sympy.solvers import solve
  
  from sympy import Product, Function, oo, IndexedBase, diff, Eq, symbols
  </code></pre>
  <p>Now, using Sympy I defined it:</p>
  <pre><code>def Maximum_Likelihood(param, pmf):
      
      i = symbols('i', positive=True)
      n = symbols('n', positive=True)
      
      Likelihood_function = Product(pmf, (i, 1, n)) 
      deriv = diff(Likelihood_function, param) 
      equation_to_solve = Eq(deriv,0) 
      
      return solve(equation_to_solve, param) 
  </code></pre>
  <p>and Bernoulli example:</p>
  <pre><code>x = IndexedBase('x')
  i = symbols('i', positive=True)
  n = symbols('n', positive=True)
  formula = (p**x[i])*((1-p)**(1-x[i]))
  
  Likelihood_function = Product(formula, (i, 1, n))
  Likelihood_function
  </code></pre>
  <p>When I want to get the outcome of Maximum_Likelihood(param, pmf):</p>
  <pre><code>param = p 
  pmf = formula
  print(Maximum_Likelihood(param, pmf))
  </code></pre>
  <p>I get &quot;[]&quot;.
  I want to obtain estimator of p that should look like:</p>
  <p><a href="https://i.stack.imgur.com/sboK8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sboK8.jpg" alt="estimator of p" /></a></p>
  <p>Could you please take a look at it and advice what I do wrong. Thank you!</p>