[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Help with C++
From: |
Germán Arias |
Subject: |
Re: [Help-gsl] Help with C++ |
Date: |
Mon, 10 Jan 2011 00:24:09 -0600 |
The only thing you need is set the seven vars (X0, X1, X2, ...):
const double x0 = gsl_vector_get (x, 0);
const double x1 = gsl_vector_get (x, 1);
const double x2 = gsl_vector_get (x, 2);
const double x3 = gsl_vector_get (x, 3);
...
const double x6 = gsl_vector_get (x, 6);
then make the seven equations:
const double y0 = 2*X0 + X1 ...
const double y1 = ...
const double y2 = ...
....
const double y6 = ...
and put the equations:
gsl_vector_set (f, 0, y0);
gsl_vector_set (f, 1, y1);
...
gsl_vector_set (f, 6, y6);
at main function you need change the size to 7:
const size_t n = 7;
put seven values:
double x_init[7] = {-10.0, -5.0, 2.5, 4, 9, 0.3, 6};
init vars:
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, 6, x_init[6]);
Don't forgot that are 7 equations:
s = gsl_multiroot_fsolver_alloc (T, 7);
that is all.
On dom, 2011-01-09 at 17:35 +0000, Mohammad Ghanim wrote:
> Dear All,
>
> I will appriciate if someone could help me with using the multiroot
> findingcode of Gsl to be used for solving seven set of equations. I look at
> the example code which is for two variable and I cannot modified for seven
> equations.
>
> With All the respect
>
>
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl