[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Help with multidimensional root finding
From: |
Laura Marinho |
Subject: |
[Help-gsl] Help with multidimensional root finding |
Date: |
Fri, 14 Nov 2014 10:22:34 -0700 |
Hello,
I have written a code to solve 5 non-linear coupled equations using gsl. I
have a few constants that are set in the beginning of the code and one
input parameter, rho, that is changed in a loop. The program works fine for
a given set of parameters (G300) but for a different one (GM4) it is
working only for small rho. I always use the solution found for rho for the
initial guess of rho+Delta_rho but I start receiving the "not making
progress towards the solution" error from a certain value of rho when using
the GM4 set of parameters.
In main, I have
gsl_multiroot_function f = {&Walecka_f, n, &p};
double x_init[5] = {gss_i, gww_i, grr_i, mun_i, mue_i};
gsl_vector *x=gsl_vector_alloc(n);
gsl_vector_set(x, 0, x_init[0]);
gsl_vector_set(x, 1, x_init[1]);
gsl_vector_set(x, 2, x_init[2]);
gsl_vector_set(x, 3, x_init[3]);
gsl_vector_set(x, 4, x_init[4]);
T = gsl_multiroot_fsolver_hybrid;
s = gsl_multiroot_fsolver_alloc(T, 5);
gsl_multiroot_fsolver_set(s, &f, x);
do
{
iter++;
status = gsl_multiroot_fsolver_iterate (s);
if (status) /* check if solver is stuck */
break;
status = gsl_multiroot_test_residual (s->f, 1e-7);
}
while (status == GSL_CONTINUE && iter < 1000);
printf ("status = %s\n", gsl_strerror (status));
I I have also attached the code so if anyone can help, I would really
appreciate it.
Thanks,
Laura
Walecka.c
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-gsl] Help with multidimensional root finding,
Laura Marinho <=