2
$\begingroup$

I'm currently trying to solve a system of (3) nonlinear equations of (3) variables which are the baryonic density, the isospin asymmetry and and the density of a fluid with the Broyden's method (a quasi-Newton method) included in the GSL.

The problem is that I don't know how to avoid negative roots. I don't want them because it's obviously nonphysical. I guess I should use some conditions but I don't know which ones... I'm programming in C.

Could you help please?

Thanks in advance!

$\endgroup$
  • 2
    $\begingroup$ Would Computational Science be a better home for this question? $\endgroup$ – Qmechanic Mar 30 '17 at 10:04
  • 5
    $\begingroup$ I'm voting to close this question as off-topic because it is about software design and not physics. Computational Science or Stack Overflow might be better suited. $\endgroup$ – Kyle Kanos Mar 30 '17 at 10:10
  • 1
    $\begingroup$ Kinsol, part of the Sundials solver suite (computation.llnl.gov/projects/sundials/kinsol), solves systems of nonlinear algebraic equations, allows you to specify inequality constraints on the variables, and is callable from C. $\endgroup$ – Bill Greene Mar 30 '17 at 16:20
  • 3
    $\begingroup$ @nukeguy I'm not sure a Log change of variable is well advised here, as it might lead to poor conditioning. A linear COV might make more sense, though the solution of Bill seems most direct. $\endgroup$ – Spencer Bryngelson Mar 31 '17 at 14:42
  • 1
    $\begingroup$ Maybe you should include the system of equations you're solving, for reference? $\endgroup$ – J. M. Apr 1 '17 at 9:13
0
$\begingroup$

I finally solved my problem.

I still use the GSL but I changed the Broyden's method for the classical discrete Newton's method because I saw that Broyden's method "is not recommended for serious use" (source: https://www.gnu.org/software/gsl/manual/html_node/Algorithms-without-Derivatives.html#Algorithms-without-Derivatives).

I also programmed "mirrors" to avoid nonphysical values.

Thanks for the assistance.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.