Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am trying to implement the newton method for maximization in higher dimensions and I was wondering if there exists any solvers for this in Python? In Scipy there is a solver for the 1-dimensional case, but I do not see one for the multi-dimensional case. I suppose that it is possible to implement it using the Hessian and Gradient solvers in Numdifftools
EDIT:
It looks like scipy.optimize.minimize does this. I was looking under the multi-dimensional heading and it wasn't there, that's why I missed it. It was under the general-purpose heading
scipy.optimize.minimize does this.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I am looking for predefined functions that implement in Python the Gauss and the Jacobi methods for solving linear equations. Are there any or I must write them myself?
I don't think so. At least not in python cores predefined functions. There are some functions in NumPy to calculate the eigenvalue using LAPACK. But I doubt anyone uses Gaussian and Jacobian methods these days. They are not particularly general and there are some cases in which the algorithm breaks down.
On the other hand, there are various implementations on the internet that you can use if you want.
Here are some examples:
Link 1: Gausian Implementation
Link 2: Jacobian Implementation No.1
Link 3: Jacobian Implementation No.2
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
right now I'm looking for an sklearn method that does something like:
arr = [13,15,41,45,90,100]
print(KMeans.num_clusters(arr))
Outputs 3
You can use mean-shift clustering. It does not require number of clusters beforehand. However, the drawback of mean shift is that it is not very efficient compared to the k-means. Since your example array is only 1 dimensional it should not be a problem. If you are going to use mean-shift with 2 or more dimensional data, be careful with the curse of dimensionality.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I have this optimization problem and I wonder any function in any python library can solve it? Say I want to minimize f(x) by gradient descent. x is a vector of say 3 dimensions, x=(x1,x2,x3). The constraint is x1>0, x2>0, x3>0, and x1+x2+x3=1. Any function can solve this constrained gradient descent? Thank you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I have a huge set of coupled nonlinear integro-partial differential equations. After a long while trying to simplify the equations and solve them at least semi-analytically I have come to conclude there has been left no way for me but an efficient numerical method. Finite element seems most amenable as is based on Galerkin method which gives a weak form solution, so a great hope that it might finally solve the equations. But at the same time I am so new to this field to write the codes all from the scratch:
Is there any Python library already available that can efficiently do a Finite Element analysis?
Also I was interested if softwares like FEniCS/Dolphin might also solve integro-differential equations?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there any library available to have inverse of a function? To be more specific, given a function y=f(x) and domain, is there any library which can output x=f(y)? Sadly I cannot use matlab/mathematics in my application, looking for C/Python library..
I am a bit late, but for future readers of the post, I just published a python package that does this precisely. https://pypi.python.org/pypi/pynverse
There is a detailed description of how to use it and how it does it in the description!
As has already been mentioned, not all functions are invertible. In some cases imposing additional constraints helps: think about the inverse of sin(x).
Once you are sure your function has a unique inverse, solve the equation f(x) = y. The solution gives you the inverse, y(x).
In python, look for nonlinear solvers from scipy.optimize.