[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Multi root finding

From: Mohammad Ghanim
Subject: [Help-gsl] Multi root finding
Date: Mon, 10 Jan 2011 21:38:58 +0000 (GMT)

Dear Sir 
Thank you very much for your help. I have another question please. For multi 
root finding with gsl the problem is when I mange the software for seven sets 
of equations the output is still similar to the example code for two dimension 
1-     How to manage the  output to print all the final values of the  
variables for example, x0, x1, x2, x3,  x4, x5, x6
2-     How to use the gsl code to calculate the following ,
 Double  m, E;
for (m = 0; m <= 13; m++)  
Here the gsl code for multi root finding where (m)  is multiplied by any 
variable and it is existed at all the seven equations. Hence, for each value of 
m we have new values for all the variables and then I would choose (x0) for 
each (m) to evaluate,
cout <<E;

--- On Mon, 10/1/11, Germán Arias <address@hidden> wrote:

From: Germán Arias <address@hidden>
Subject: Re: [Help-gsl] Help with C++
To: "Mohammad Ghanim" <address@hidden>
Cc: address@hidden
Date: Monday, 10 January, 2011, 6:24

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]