Gj

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Gj as PDF for free.

More details

  • Words: 297
  • Pages: 2
#include <stdio.h> #include <math.h> #define mp 3 struct {int ix,iy,itab[128];} ran; int rseed(int ix,int iy); double rndmf(); double gaussj(double a[][mp], int n,double b[]); void main(void) {int i,j,k,n=3,ix=57,iy=89; double a[3][3],at[3][3],as[3][3],b[3]; rseed(ix,iy); for (i=0;i<3;++i){ for (j=0;j<3;++j){ a[i][j]=rndmf()*10;}} for (j=0;j<3;++j){ a[j][j]=1;} for (i=0;i<3;++i){ for (j=0;j<3;++j){ as[i][j]=a[i][j];}} for (j=0;j<3;j++){ printf(" col %d %6f %6f %6f \n",j, as[0][j],as[1][j],as[2][j]);} gaussj(a,n,b); for(i=0;i<3;i++){ for (j=0;j<3;j++){ at[j][i]=0; for(k=0;k<3;k++){ at[j][i]+=as[i][k]*a[k][j];}}} printf(" unit matrix? \n"); for (i=0;i<3;i++) {for (j=0;j<3;j++)printf(" %d %d %6f ",j,i,a[j][i]); printf("\n");} for (i=0;i<3;i++) {for (j=0;j<3;j++)printf(" %d %d %6f ",j,i,at[j][i]); printf("\n");} } double gaussj(double a[][mp], int n,double b[]) {int i,j,k,l,ll,irow,icol,ipiv[mp],indxr[mp],indxc[mp]; double big,temp,pivinv; for(i=0;i= big) {big=fabs(a[j][k]); irow=j; icol=k; } else {if(ipiv[k]>1) {printf(" error 1 /n"); scanf(" %lf",temp); return 1; }

} } /* endif of if then else */ } /* 12 continue */ } /* endif of ipiv(j).ne.1 */ } /* 13 continue */ ipiv[icol]+=1;/* do 13 above */ if(irow!=icol) {for (l=0;l

Related Documents

Gj
November 2019 18
Gj
May 2020 12
Gj Wildlife
October 2019 30
Icse 08 Result Analysis Gj
October 2019 20
Harrington Bruno Gj 109
December 2019 14