help-gsl
[Top][All Lists]

## Re: [Help-gsl] multiroot and complex

 From: Patrick Alken Subject: Re: [Help-gsl] multiroot and complex Date: Tue, 5 Apr 2016 15:32:37 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

```Hello,

There do exist gsl_vector_complex and gsl_matrix_complex types,
everything is the same as the gsl_vector/matrix but you pass in

Regarding polynomials, yes currently there is only support for finding
roots of polynomials with real coefficients. This is because the
underlying algorithm requires computing the eigenvalues of a
nonsymmetric matrix. GSL currently only implements a real nonsymmetric
eigenvalue algorithm.

I recommend you form the (complex) companion matrix manually for your
polynomial (see Wikipedia for info), and then use the LAPACK complex
eigenvalue solver to compute the roots. It is unlikely a complex
nonsymmetric eigenvalue solver will be added to GSL anytime soon
unfortunately.

Patrick

On 04/04/2016 03:13 PM, sholman wrote:
> Hello All, I have successfully ran examples in GSL from my IDE (eclipse
> mars) and in the terminal "by hand", but I want to ask before I start
> this new project, a question.
>
>
> I have polynomials, and/or systems of such, that are nonlinear and
> complex, something like,
>
> 0 = fn1(a1,#,I)*z  + fn2(a2,#,I)*z^2 + fn3(a3,#,I)*z^3 + ...
>
> where "#" are just numbers (complex), and "I" is sqrt{-1},
>
> and I want to solve for the unknowns a1, a2, a3, ... by setting each
> coefficient equal to zero. This is similar to solving differential
> equations by the power series method.
>
> Anyway, the coefficient/equations are long and so I thought I'd ask
> first. As I notice things like gsl_vector_complex_real and
> gsl_complex_vector_imag, but not "complex" versions of gsl_vector or
> gsl_vector_get, can I change the example code;
>
> https://www.gnu.org/software/gsl/manual/html_node/Example-programs-for-Multidimensional-Root-finding.html#Example-programs-for-Multidimensional-Root-finding
>
> to one for (a) polynomial(s) in a ring C[z]..?
>
> *********
>
> I also noticed;
>
> https://www.gnu.org/software/gsl/manual/html_node/Roots-of-Polynomials-Examples.html#Roots-of-Polynomials-Examples
>
> but again it looks like the coefficients might not be able to be
> complex....?
>
> If there is an example somewhere of something like solving for the roots
> of P(z) = z^6 + 3*I*z^4 + ln(3)*I*z = 0, then I can adapt it as necessary.
>
> Also, is there a way to implement support right away for very large or
> small numbers beyond just declaring doubles?
>
>