/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:13 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_dwcomp s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_dwcomp.h" /* program DRDWCOMP *>> 1994-10-19 DRDWCOMP Krogh Changes to use M77CON *>> 1987-12-09 DRDWCOMP Lawson Initial Code. *--D replaces "?": DR?WCOMP, ?WSET, ?VECP, ?WSQRT, ?WLOG, ?WPRO1, ?WEXP, *--& ?WDIF, ?WCOMP * Demo driver for the DWCOMP package. Derivative arithmetic. * ------------------------------------------------------------------ */ /* PARAMETER translations */ #define NDIM (NMAX + 1) #define NMAX 3 #define ONE 1.0e0 #define TWO 2.0e0 /* end of PARAMETER translations */ int main( ) { long int n; double diff[NDIM], t[NDIM], x1[NDIM], x2[NDIM], z1[NDIM], z2[NDIM]; /* OFFSET Vectors w/subscript range: 1 to dimension */ double *const Diff = &diff[0] - 1; double *const T = &t[0] - 1; double *const X1 = &x1[0] - 1; double *const X2 = &x2[0] - 1; double *const Z1 = &z1[0] - 1; double *const Z2 = &z2[0] - 1; /* end of OFFSET VECTORS */ /* ------------------------------------------------------------------ */ printf("DRDWCOMP.. Demo driver for the DWCOMP package.\n"); n = NMAX; /* Set T = 2.0 */ dwset( n, TWO, ONE, t ); dvecp( t, n + 1, "0 T =" ); /* Compute Z1 = log(sqrt(T)) */ dwsqrt( n, t, x1 ); dwlog( n, x1, z1 ); dvecp( z1, n + 1, "0 Z1 = log(sqrt(T)) =" ); /* Compute Z2 = exp(2.0 * Z1) */ dwpro1( n, TWO, z1, x2 ); dwexp( n, x2, z2 ); dvecp( z2, n + 1, "0 Z2 = exp(2.0 * Z1) =" ); /* Diff = Z2 - T */ dwdif( n, z2, t, diff ); dvecp( diff, n + 1, "0 DIFF = Z2 - T =" ); exit(0); } /* end of function */