help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Contributed GSL examples


From: Brian Gough
Subject: Re: [Help-gsl] Contributed GSL examples
Date: Mon, 26 Jul 2004 13:56:49 +0100

Jon Drews writes:
 >  I have a few GSL example programs here:
 > http://www.silbsd.org/projects/GSL.tar.gz
 > The tarball contains examples for chapters 5, 6, 7 and one integration
 > from chapter 16. I will be adding more in due time.

Hello, 
one suggestion regarding the code below, probably it is safer to
define x0,x1,x2 as automatic variables and pass as &x0,&x1,&x2.

  double a, b, c, *x0, *x1,*x2;

  x0= (double *)malloc(sizeof(double));
  x1= (double *)malloc(sizeof(double));
  x2= (double *)malloc(sizeof(double));
 
  printf("Enter the coefficients a, b, c of x^3 + ax^2 + b*x + c = 0\n");
  scanf("%lf %lf %lf", &a, &b, &c);
 
  gsl_poly_solve_cubic(a, b, c, x0, x1, x2);

-- 
Brian Gough

Network Theory Ltd,
Commercial support for GSL --- http://www.network-theory.co.uk/gsl/




reply via email to

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