/* tgnlsq.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ------------------------------------------------------------------------ */ /* Test: gnlsq Uses: matprt */ #include "ccmath.h" #define ND 50 #define NP 4 /* true function parameters */ double parm[]={2.,-1.,1.5,2.}; char fnc[]="(p0+x*p1)/(1+p2*x+p3*x^2)"; void main(void) { double x[ND],y[ND],var[NP*NP],de,z,dz,*p; double ssq,fit(double u,double *v); int n=ND,np=NP,j; char fl[4]; printf(" Test of Gauss-Newton Least Squares\n"); printf(" f(x) = %s\n\n",fnc); /* define the input values by using true parameters */ for(j=0,z=0.,dz=.1; j