How To Solve An 1-parameter Equation Using Python (scipy/numpy?)
I hope you have some useful tip for me to approach the following task: I wrote some simple python snippet to plot probability density functions. In my particular case, let them rep
Solution 1:
In general, it sounds like you need the scalar root-finding functions: http://docs.scipy.org/doc/scipy/reference/optimize.html
But as others have pointed out, it seems like there is an analytical solution.
Solution 2:
Since you have a nice closed-form equation, you can solve it with SymPy.
I plugged in values for mu
and sigma
and entered this into Sympy Gamma:
solve(1.0 / ( sqrt(2*pi) *(3**0.5) ) * exp( -0.5 * ( (x-10)/(3**0.5) )**2 ) / (1.0 / ( sqrt(2*pi) *(2**0.5) ) * exp( -0.5 * ( (x-20)/(2**0.5) )**2 ))-1,x)
The result: 15.4554936768195
Post a Comment for "How To Solve An 1-parameter Equation Using Python (scipy/numpy?)"