[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: [Help-gsl] gsl_poly_solve_cubic problem
From: |
nick kama |
Subject: |
Fwd: [Help-gsl] gsl_poly_solve_cubic problem |
Date: |
Thu, 20 Dec 2007 14:37:29 +0100 |
Hello,
Thank you for your answer, i think this bad behaviour would need some more
attention.
This is an unphysical situation, it rarely happens to have a diagonal
matrix with two or more equal double, but it could happen and i think this
is an unwanted behaviour and should be fixed or documented in some-way.
Niccolo'
On Dec 20, 2007 3:15 AM, Ralph Silva <address@hidden> wrote:
> Hi Niccolo,
>
> it looks like a kind of round error of the *gsl_poly_solve_cubic* . I have
> tested your program with other GSL functions and they gave quite the same
> results. Take a look at the *gsl_poly_complex_solve_cubic *and *
> gsl_poly_complex_solve*. You will see nearly the expected result.
>
> Cheers,
> Ralph.
>
> gcc -static test.c -lgsl -lm
> GSL 1.10
> Fedora 8 - Kernel 2.6.23.8-63.fc8
> gcc 4.1.2 20070925 (Red Hat 4.1.2-33)
> Intel Core 2 Quad
>
>
> On Dec 20, 2007 11:34 AM, nick kama <address@hidden > wrote:
>
> > Hello,
> >
> > I have this problem with the solver of the cubic equations in gsl:
> >
> > if i take an equation of the form
> >
> > (x-1)^3=0
> >
> > solver finds 3 roots
> > 1 1 1
> >
> > if i took the equation
> > (x-1.1)^3
> >
> > it finds only one root equal to 1.1,this is a little of code that can
> > show
> > this behaviour.
> > Documentation says :"the case of coincident roots is not considered
> > special.
> > For example, the equation (x-1)^3=0 will have three roots with exactly
> > equal
> > values " so this should'nt happen, pleas let me know where i'm wronging.
> >
> > Many Thanks
> >
> > Niccolo'
> >
> >
> > #include <iostream>
> > #include <gsl/gsl_matrix.h>
> > #include <gsl/gsl_eigen.h>
> > #include <gsl/gsl_vector.h>
> > #include <gsl/gsl_poly.h>
> >
> >
> >
> > main()
> > {
> >
> > double landa1=0;
> > double landa2=0;
> > double landa3=0;
> > //(x-1.1)^3
> > int numero = gsl_poly_solve_cubic ( - 3.3,3.63, -1.331, &landa1,
> > &landa2,
> > &landa3);
> > std::cout << numero<< std::endl;
> > std::cout << landa1<< std::endl;
> > std::cout << landa2<< std::endl;
> > std::cout << landa3<< std::endl;
> >
> > // (x-1)^3
> > numero = gsl_poly_solve_cubic ( -3,3, -1, &landa1, &landa2, &landa3);
> > std::cout << numero<< std::endl;
> > std::cout << landa1<< std::endl;
> > std::cout << landa2<< std::endl;
> > std::cout << landa3<< std::endl;
> >
> > }
> > _______________________________________________
> > Help-gsl mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/help-gsl
> >
>
>