bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] (no subject)


From: Patrick Alken
Subject: Re: [Bug-gsl] (no subject)
Date: Mon, 22 Jul 2013 09:21:27 -0600
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7

Your program works ok for me. Here is the output I get, which checks out
against mathematica:

> ./poly
z0 = 0.000000000000002665 + 0.000000000000000000 I
z1 = -2.413669527422442673 + 0.939373996986698656 I
z2 = -2.413669527422442673 + -0.939373996986698656 I
z3 = 3.472684733794631828 + 0.916581498403646222 I
z4 = 3.472684733794631828 + -0.916581498403646222 I

I modified the program slightly to be C only (attached)

On 07/21/2013 01:07 AM, 晏雄锋 wrote:
> I am using gsl_poly_complex_solve() to determine the roots of some basic
> polynomials.
> But it failure to run.
> When I change any number of PolyParam, it works. Why? I don't know.
> Here is the code.
> Thank you very much!
>
> #include <iostream>
> #include <gsl/gsl_poly.h>
> void main()
> {
> double PolyParm[6];
> PolyParm[0] = 0;
> PolyParm[1] = 1792548;//1792549
> PolyParm[2] = 324810;
> PolyParm[3] = -288348;
> PolyParm[4] = -43875;
> PolyParm[5] = 20715;
> double z[10];
> gsl_poly_complex_workspace *w = gsl_poly_complex_workspace_alloc(6);
> gsl_poly_complex_solve(PolyParm,6,w,z);
> gsl_poly_complex_workspace_free(w);
> for (int it=0;it<5;it++)
> {
> printf("z%d = %+.18f %+ .18f\n",it,z[2*it],z[2*it+1]);
> }
> return;
> }

Attachment: poly.c
Description: Text document


reply via email to

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