ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 11 May 2015 12:42:27 +0200Solver for multiple variablehttps://ask.sagemath.org/question/26616/solver-for-multiple-variable/I have a function which depends of multiple parameters, and I need to find the parameters that minimize some error function.
Is non linear, but works well with conjugate gradient and central derivative methods on other software, which just do not have the necessary precision.
Is there something similar in PariGP?
The "solver" function seems to work only with one parameter.
Please, do not ask for more specific details about the function. This is a general question.Tue, 21 Apr 2015 21:06:22 +0200https://ask.sagemath.org/question/26616/solver-for-multiple-variable/Answer by calc314 for <p>I have a function which depends of multiple parameters, and I need to find the parameters that minimize some error function.</p>
<p>Is non linear, but works well with conjugate gradient and central derivative methods on other software, which just do not have the necessary precision.</p>
<p>Is there something similar in PariGP?</p>
<p>The "solver" function seems to work only with one parameter.</p>
<p>Please, do not ask for more specific details about the function. This is a general question.</p>
https://ask.sagemath.org/question/26616/solver-for-multiple-variable/?answer=26625#post-id-26625You can use `scipy` for this. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize.
Here is an outline of some code.
from scipy import optimize
def err(params,F):
...
return result
optimize.minimize(err,[initial values],args=(...))
Wed, 22 Apr 2015 19:38:24 +0200https://ask.sagemath.org/question/26616/solver-for-multiple-variable/?answer=26625#post-id-26625Comment by marraco for <p>You can use <code>scipy</code>for this. See <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#scipy.optimize.minimize">https://docs.scipy.org/doc/scipy/refe...</a>. </p>
<p>Here is an outline of some code.</p>
<pre><code>from scipy import optimize
def err(params,F):
...
return result
optimize.minimize(err,[initial values],args=(...))
</code></pre>
https://ask.sagemath.org/question/26616/solver-for-multiple-variable/?comment=26794#post-id-26794Thanks!
I was told that it is not possible in PariGP, so I gave up, and just today I found your answer.
Hope it works.Mon, 11 May 2015 12:42:27 +0200https://ask.sagemath.org/question/26616/solver-for-multiple-variable/?comment=26794#post-id-26794