/* nag_ode_bvp_fd_lin_gen (d02gbc) Example Program. * * Copyright 1992 Numerical Algorithms Group. * * Mark 3, 1992. * Mark 7 revised, 2001. * Mark 8 revised, 2004. * */ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif static void fcnf(Integer neq, double x, double f[], Nag_User *comm); #ifdef __cplusplus } #endif #define NEQ 2 #define MNP 70 #define C(I,J) c[(I)*tdc + J] #define D(I,J) d[(I)*tdd + J] #define Y(I,J) y[(I)*tdy + J] int main(void) { Integer exit_status=0, i, j, mnp, neq, np, tdc, tdd, tdy; NagError fail; Nag_User comm; double a, b, *c=0, *d=0, eps, *gam=0, tol, *x=0, *y=0; INIT_FAIL(fail); Vprintf("nag_ode_bvp_fd_lin_gen (d02gbc) Example Program Results\n"); /* For communication with function fcnf() * assign address of eps to comm.p. */ comm.p = (Pointer)&eps; neq = NEQ; mnp = MNP; tol = 1.0e-3; np = 0; a = 0.0; b = 1.0; if (mnp>=32 && neq>=2) { if ( !( c = NAG_ALLOC(NEQ*NEQ, double)) || !( d = NAG_ALLOC(NEQ*NEQ, double)) || !( gam = NAG_ALLOC(NEQ, double)) || !( x = NAG_ALLOC(MNP, double)) || !( y = NAG_ALLOC(NEQ*MNP, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } tdc = neq; tdd = neq; tdy = mnp; } else { exit_status = 1; return exit_status; } for (i=0; ip; F(0,0) = 0.0; F(0,1) = 1.0; F(1,0) = 0.0; F(1,1) = -1.0/ *eps; }