0

I have a function (x^x)*((1-x)^(1-x))*(k^(x/2)) = 1 which has a unique solution in 0 < x < 1 for a given natural number k.

Can I use Python to find these solutions, or is my equation too complicated?

dot.Py
  • 5,007
  • 5
  • 31
  • 52
user422504
  • 13
  • 2

1 Answers1

0

Yes, you can use Python to solve this equation.

I suggest you fix k=2 to simplify. Wolfram Alpha can verify your results: https://www.wolframalpha.com/input/?i=(x%5Ex)((1-x)%5E(1-x))(2%5E(x%2F2))+%3D+1

Depending on how you do your root search, you may have to take a first derivative with respect to x and place that into Python, as well.

rajah9
  • 11,645
  • 5
  • 44
  • 57
  • I would like to find the solution for every k from 2 to 100. Can Numpy do this? I really know almost nothing about programming, so I'm not too sure – user422504 Mar 30 '17 at 13:30
  • Yes, you can solve this using Numpy. Can you look at Chris Mueller's answer at http://stackoverflow.com/a/43048035/509840 ? You would switch out Chris's opt_fun with your own. – rajah9 Mar 30 '17 at 14:14
  • It didn't work. I got the error "numpy.ndarray object is not callable" when I changed nothing in his code except the function. – user422504 Apr 02 '17 at 19:21