Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Linear Algebra and the C Language/a07n

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

__NOTOC__ Install this file in your working directory. /* ------------------------------------ */ /* Save as : dpoly.h */ /* ------------------------------------ */ void i_A_b_with_XY_mR( double **XY, double **A, double **b ) { int r = R1; int c = C1; int power = 0; for(r=R1; r<XY[R_SIZE][C0]; r++) { power=rsize_R(XY)-R1; for(c=C1; c<A[C_SIZE][C0]; c++) A[r][c]=pow(XY[r][C1],power--); b[r][C1]=XY[r][C2]; } } /* --------------------------------- */ void p_eq_poly_mR( double **Ab ) { int r = R1; int power = rsize_R(Ab)-R1; int cL = csize_R(Ab); printf(" y = "); for(r=R1;r<Ab[R_SIZE][C0];r++) if(Ab[r][cL]) { if(!power) printf(" %+.3f", Ab[r][cL]); else if(power==1){printf(" %+.3fx", Ab[r][cL]);power--;} else printf(" %+.3fx**%d",Ab[r][cL], power--); } else power--; printf("\n\n\n"); } /* --------------------------------- */ void verify_X_mR( double **Ab, double x ) { int r = R1; int power = rsize_R(Ab)-R1; int cL = csize_R(Ab); double y = 0.; for(;r<Ab[R_SIZE][C0];r++) y+= Ab[r][cL]*pow(x,power--); printf(" With x = %+.3f, y = %+.3f \n",x,y); } /* --------------------------------- */ /* --------------------------------- */