SlideShare a Scribd company logo
1 of 22
Download to read offline
ME4010 Computational Methods for
Mechanical Engineering
Chapter 4 Solution of system of equations
Instructor: Nikolai V. Priezjev
Office: 430 Russ Engineering Center
Phone: 937-775-3214
Email: nikolai.priezjev@wright.edu
The course is adopted from Prof. Huang at WSU
 
 
)(
2)(
2
23332
2
3
1222322
2
2
111212
2
1
xxkgmx
dt
d
m
xxkgmxxkx
dt
d
m
kxgmxxkx
dt
d
m



1 2 1
1 2 3 2
2 3 3
3 2 0
2 3
0
kx kx m g
kx kx kx m g
kx kx m g
  
   
  
The steady state equations are:
1 1
2 2
3 3
3 2 0
2 3
0
k k x m g
k k k x m g
k k x m g
     
            
          
In matrix form:
Dynamics
Statics
R1 + T1 cos 60 + T2 = 0
R2 + T1 sin 60 = 0
-T2 -T3 cos 60 + T4 cos 60 + T5 = 0
T3 sin 60 + T4 sin 60 = 0
-T5 - T6 cos 60 = 0
T6 sin 60 + R3 = 0
-T1 cos 60 + T3 cos 60 + T7 - F1 cos = 0
-T1 sin 60 - T3 sin 60 - F1 sin= 0
-T4 cos 60 - T7 + T6 cos 60 - F2 cos  = 0
-T4 sin 60 - T6 sin 60 - F2 sin = 0
In matrix form
1 cos60 1 0 0 0 0 0 0 0
0 sin60 0 1 0 0 0 0 0 0
0 0 1 0 cos60 cos60 1 0 0 0
0 0 0 0 sin60 sin60 0 0 0 0
0 0 0 0 0 0 1 cos60 0 0
0 0 0 0 0 0 0 sin60 1 0
0 cos60 0 0 cos60 0 0 0 0 1
0 sin60 0 0 sin60 0 0 0 0 0
0 0 0 0 0 cos60 0 cos60 0 1
0 0 0 0 0 sin60 0 sin60 0 0
 
 
 
  
 
 
  
 

 

 
  
   
1
1
2
2
3
4
5 1 1
6 1 1
3 2 2
7 2 2
0
0
0
0
0
0
cos
sin
cos
sin
R
T
T
R
T
T
T F
T F
R F
T F




   
   
   
   
   
   
   
    
   
   
   
   
   
   
      
Circuit
1
2
3
4
9 4 2 0 24
4 17 6 3 16
2 6 14 6 0
0 3 6 11 18
i
i
i
i
      
           
      
    
     
V = I * R
1: i1*9 - i2*4 - i3*2 = 24
Method
[A] = [L][U]
where
[L] = lower triangular matrix
[U] = upper triangular matrix
LU Decomposition
Given [A][X] = [B]
1. Decompose [A] into [L] and [U]
2. Solve [L][Z] = [B] for [Z]
3. Solve [U][X] = [Z] for [X]
Method: [A] Decomposes to [L] and [U]
    





















33
2322
131211
3231
21
00
0
1
01
001
u
uu
uuu
ULA


[U] is the same as the coefficient matrix at the end of the forward elimination step.
[L] is obtained using the multipliers that were used in the forward elimination process
Finding the [U] matrix
Using the Forward Elimination Procedure of Gauss Elimination
112144
1864
1525










 
112144
56.18.40
1525
56.212;56.2
25
64










 RowRow
 
76.48.160
56.18.40
1525
76.513;76.5
25
144











 RowRow
Step 1:
Finding the [U] Matrix
Step 2:












76.48.160
56.18.40
1525
 
7.000
56.18.40
1525
5.323;5.3
8.4
8.16













RowRow
 











7.000
56.18.40
1525
U
Matrix after Step 1:
Finding the [L] matrix
Using the multipliers used during the Forward Elimination Procedure










1
01
001
3231
21


56.2
25
64
11
21
21 
a
a

76.5
25
144
11
31
31 
a
a

From the first step
of forward
elimination
112144
1864
1525










Finding the [L] Matrix
 











15.376.5
0156.2
001
L
From the second
step of forward
elimination












76.48.160
56.18.40
1525
5.3
8.4
8.16
22
32
32 



a
a

Does [L][U] = [A]?
   






















7.000
56.18.40
1525
15.376.5
0156.2
001
UL
?
112144
1864
1525










Try this…
4 2 3 6
6 7 6.5 6
1 7.5 6.25 5.5
12 22 15.5 1
  
   
 
 
  
Using LU Decomposition to solve SLEs
Solve the following set of
linear equations using LU
Decomposition































2279
2177
8106
112144
1864
1525
3
2
1
.
.
.
x
x
x
Using the procedure for finding the [L] and [U] matrices
    






















7.000
56.18.40
1525
15.376.5
0156.2
001
ULA
Example
Set [L][Z] = [B]
Solve for [Z]































2.279
2.177
8.106
15.376.5
0156.2
001
3
2
1
z
z
z
1
1 2
1 2 3
106.8
2.56 177.2
5.76 3.5 279.2
z
z z
z z z

 
  
Example
Complete the forward substitution to solve for [Z]
 
   
735.0
21.965.38.10676.52.279
5.376.52.279
2.96
8.10656.22.177
56.22.177
8.106
213
12
1







zzz
zz
z
 






















735.0
21.96
8.106
3
2
1
z
z
z
Z
Example
Set [U][X] = [Z]
Solve for [X] The 3 equations become
































7350
2196
8106
7.000
56.18.40
1525
3
2
1
.
.
.
x
x
x
1 2 3
2 3
3
25 5 106.8
4.8 1.56 96.21
0.7 0.735
x x x
x x
x
  
   

Example
From the 3rd equation
3
3
3
0 7 0 735
0 735
0 7
1 050
. x .
.
x
.
x .



Substituting in a3 and using the
second equation
2 34 8 1 56 96 21. x . x .   
 
3
2
2
2
96 21 1 56
4 8
96 21 1 56 1 050
4 8
19 70
. . x
x
.
. . .
x
.
x .
 


 



Example
Substituting in a3 and a2 using
the first equation
1 2 325 5 106 8x x x .  
Hence the Solution Vector is:
1
2
3
0.2900
19.70
1.050
x
x
x
   
      
       
2 3
1
106 8 5
25
106 8 5 19 70 1 050
25
0 2900
. x x
x
. . .
.
 

 


Try this…
1
2
3
4
4 2 3 6 12
6 7 6.5 6 6.5
1 7.5 6.25 5.5 16
12 22 15.5 1 17
x
x
x
x
      
          
    
    
     
Module LU_solver
Contains
! SUBROUTINE TO PERFORM DOLITTLE FACTORIZATION: A=LU
SUBROUTINE LU(N,A,B,X)
integer::N,I,j,k
double precision:: A(N,N),L(N,N),U(N,N),B(N),Z(N),X(N)
double precision:: S,S1,S2,SS,S3,S4
DO I = 1,N
L(I,I)=1.
ENDDO
U(1,1)=A(1,1)
IF(U(1,1).EQ.0.)THEN
WRITE(1,*)'LU FACTORIZATION IS IMPOSSIBLE'
RETURN
ENDIF
DO J =2,N
U(1,J)=A(1,J) ! DETERMINE THE FIRST ROW OF U
L(J,1)=A(J,1)/U(1,1) ! DETERMINE THE FIRST COLUMN OF XL
ENDDO
DO I = 2, N-1
S=0.
DO K = 1, I-1
S=S+L(I,K)*U(K,I)
ENDDO
U(I,I)= A(I,I)-S
IF(U(I,I).EQ.0.)THEN
WRITE(1,*)'LU FACTORIZATION IS IMPOSSIBLE'
RETURN
ENDIF
DO J = I+1, N
S1=0.
S2=0.
DO K = 1, I-1
S1=S1+L(I,K)*U(K,J) ! DETERMINE THE (ith) ROWS OF U
S2=S2+L(J,K)*U(K,I) ! DETERMINE THE (ith) COLUMN OF XL
U(I,J)=A(I,J)-S1
L(J,I)=(A(J,I)-S2)/U(I,I)
ENDDO
ENDDO
ENDDO
SS=0
DO K = 1,N-1
SS=SS+L(N,K)*U(K,N)
U(N,N)=A(N,N)-SS
ENDDO
IF(U(N,N).EQ.0) THEN
WRITE(1,*)' THE MATRIX A IS SINQULAR'
ENDIF
! SUBROUTINE TO SOLVE LZ=B USING FORWARD SUBSTITUTION
Z(1)=B(1)
DO I =2,N
S3=0.
DO J =1,I-1
S3=S3+L(I,J)*Z(J)
ENDDO
Z(I)=B(I)-S3
ENDDO
X(N)=Z(N)/U(N,N)
DO K = N-1,1,-1 ! SOLVING UX=Z
S4=0.
DO J=K+1,N
S4=S4+U(K,J)*X(J)
ENDDO
X(K)=(Z(K)-S4)/U(K,K)
ENDDO
RETURN
END subroutine LU
end module solver
program main
use LU_solver
double precision, dimension(4,4)::A
double precision, dimension (4)::B,X
integer::i,j,N=4
open (1, file='matrix.dat')
do i=1,n
read(1,*)(a(i,j),J=1,N)
enddo
read(1,*)B
call LU(N,A,B,X)
print *,x
stop
end program main 4. -2. -3. 6.
-6. 7. 6.5 -6.
1. 7.5 6.25 5.5
-12. 22. 15.5 -1.
12. -6.5 16. 17.
matrix.dat file
1
2
3
4
4 2 3 6 12
6 7 6.5 6 6.5
1 7.5 6.25 5.5 16
12 22 15.5 1 17
x
x
x
x
      
          
    
    
     

More Related Content

What's hot

Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...JamesMa54
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spacesEasyStudy3
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniquesKrishna Gali
 
NUMERICAL METHODS -Iterative methods(indirect method)
NUMERICAL METHODS -Iterative methods(indirect method)NUMERICAL METHODS -Iterative methods(indirect method)
NUMERICAL METHODS -Iterative methods(indirect method)krishnapriya R
 
Iit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationIit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationDev Singh
 
Gradient , Directional Derivative , Divergence , Curl
Gradient , Directional Derivative , Divergence , Curl Gradient , Directional Derivative , Divergence , Curl
Gradient , Directional Derivative , Divergence , Curl VishalVishwakarma59
 
서포트 벡터 머신(Support Vector Machine, SVM)
서포트 벡터 머신(Support Vector Machine, SVM)서포트 벡터 머신(Support Vector Machine, SVM)
서포트 벡터 머신(Support Vector Machine, SVM)Hansol Kang
 
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONS
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONSMa8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONS
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONSBIBIN CHIDAMBARANATHAN
 
system of algebraic equation by Iteration method
system of algebraic equation by Iteration methodsystem of algebraic equation by Iteration method
system of algebraic equation by Iteration methodAkhtar Kamal
 
Dobule and triple integral
Dobule and triple integralDobule and triple integral
Dobule and triple integralsonendra Gupta
 
Matrix Methods of Structural Analysis
Matrix Methods of Structural AnalysisMatrix Methods of Structural Analysis
Matrix Methods of Structural AnalysisDrASSayyad
 
Tensor Train decomposition in machine learning
Tensor Train decomposition in machine learningTensor Train decomposition in machine learning
Tensor Train decomposition in machine learningAlexander Novikov
 
Transformations (complex variable & numerical method)
Transformations (complex variable & numerical method)Transformations (complex variable & numerical method)
Transformations (complex variable & numerical method)Digvijaysinh Gohil
 
Gram-Schmidt Orthogonalization and QR Decompositon
Gram-Schmidt Orthogonalization and QR Decompositon Gram-Schmidt Orthogonalization and QR Decompositon
Gram-Schmidt Orthogonalization and QR Decompositon Mohammad Umar Rehman
 
Verification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalVerification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalMdAlAmin187
 

What's hot (20)

Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...Fast and efficient exact synthesis of single qubit unitaries generated by cli...
Fast and efficient exact synthesis of single qubit unitaries generated by cli...
 
Matrices i
Matrices iMatrices i
Matrices i
 
Inner product spaces
Inner product spacesInner product spaces
Inner product spaces
 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
 
Relaxation method
Relaxation methodRelaxation method
Relaxation method
 
NUMERICAL METHODS -Iterative methods(indirect method)
NUMERICAL METHODS -Iterative methods(indirect method)NUMERICAL METHODS -Iterative methods(indirect method)
NUMERICAL METHODS -Iterative methods(indirect method)
 
Iit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY TrajectoryeducationIit jam 2016 physics solutions BY Trajectoryeducation
Iit jam 2016 physics solutions BY Trajectoryeducation
 
Gradient , Directional Derivative , Divergence , Curl
Gradient , Directional Derivative , Divergence , Curl Gradient , Directional Derivative , Divergence , Curl
Gradient , Directional Derivative , Divergence , Curl
 
서포트 벡터 머신(Support Vector Machine, SVM)
서포트 벡터 머신(Support Vector Machine, SVM)서포트 벡터 머신(Support Vector Machine, SVM)
서포트 벡터 머신(Support Vector Machine, SVM)
 
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONS
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONSMa8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONS
Ma8353 TRANSFORMS AND PARTIAL DIFFERENTIAL EQUATIONS
 
system of algebraic equation by Iteration method
system of algebraic equation by Iteration methodsystem of algebraic equation by Iteration method
system of algebraic equation by Iteration method
 
Integration SPM
Integration SPMIntegration SPM
Integration SPM
 
Dobule and triple integral
Dobule and triple integralDobule and triple integral
Dobule and triple integral
 
1638 vector quantities
1638 vector quantities1638 vector quantities
1638 vector quantities
 
Matrix Methods of Structural Analysis
Matrix Methods of Structural AnalysisMatrix Methods of Structural Analysis
Matrix Methods of Structural Analysis
 
Tensor Train decomposition in machine learning
Tensor Train decomposition in machine learningTensor Train decomposition in machine learning
Tensor Train decomposition in machine learning
 
Transformations (complex variable & numerical method)
Transformations (complex variable & numerical method)Transformations (complex variable & numerical method)
Transformations (complex variable & numerical method)
 
Gram-Schmidt Orthogonalization and QR Decompositon
Gram-Schmidt Orthogonalization and QR Decompositon Gram-Schmidt Orthogonalization and QR Decompositon
Gram-Schmidt Orthogonalization and QR Decompositon
 
Verification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalVerification of Solenoidal & Irrotational
Verification of Solenoidal & Irrotational
 
Calculo integral - Larson
Calculo integral - LarsonCalculo integral - Larson
Calculo integral - Larson
 

Similar to Numerical Methods: Solution of system of equations

MMAC presentation 16_09_20_20_41.pptx
MMAC presentation 16_09_20_20_41.pptxMMAC presentation 16_09_20_20_41.pptx
MMAC presentation 16_09_20_20_41.pptxJuber33
 
Factorization from Gaussian Elimination
  Factorization from Gaussian Elimination  Factorization from Gaussian Elimination
Factorization from Gaussian EliminationMudassir Parvi
 
07. LU Decomposition.pptx
07. LU Decomposition.pptx07. LU Decomposition.pptx
07. LU Decomposition.pptxkibriaswe
 
Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii Mohammad Imran
 
Newton two Equation method
Newton two Equation  method Newton two Equation  method
Newton two Equation method shanto017
 
math1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfmath1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfHebaEng
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3AhsanIrshad8
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsSarvesh Rawat
 
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291z
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291zSolutions manual for college algebra 10th edition by larson ibsn 9781337282291z
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291zCerto612
 
Constant strain triangular
Constant strain triangular Constant strain triangular
Constant strain triangular rahul183
 
Perfect method for Frames
Perfect method for FramesPerfect method for Frames
Perfect method for Framesandreslahe
 
T.I.M.E. JEE Advanced 2013 Solution Paper1
T.I.M.E. JEE Advanced 2013 Solution Paper1T.I.M.E. JEE Advanced 2013 Solution Paper1
T.I.M.E. JEE Advanced 2013 Solution Paper1askiitians
 
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...nutkoon
 

Similar to Numerical Methods: Solution of system of equations (20)

MMAC presentation 16_09_20_20_41.pptx
MMAC presentation 16_09_20_20_41.pptxMMAC presentation 16_09_20_20_41.pptx
MMAC presentation 16_09_20_20_41.pptx
 
Lelt 240 semestre i-2021
Lelt   240 semestre i-2021Lelt   240 semestre i-2021
Lelt 240 semestre i-2021
 
Factorization from Gaussian Elimination
  Factorization from Gaussian Elimination  Factorization from Gaussian Elimination
Factorization from Gaussian Elimination
 
Central tedancy & correlation project - 2
Central tedancy & correlation project - 2Central tedancy & correlation project - 2
Central tedancy & correlation project - 2
 
07. LU Decomposition.pptx
07. LU Decomposition.pptx07. LU Decomposition.pptx
07. LU Decomposition.pptx
 
Project_Report.pdf
Project_Report.pdfProject_Report.pdf
Project_Report.pdf
 
1st Semester Physics Cycle (Dec-2015; Jan-2016) Question Papers
1st Semester Physics Cycle  (Dec-2015; Jan-2016) Question Papers1st Semester Physics Cycle  (Dec-2015; Jan-2016) Question Papers
1st Semester Physics Cycle (Dec-2015; Jan-2016) Question Papers
 
Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii Question bank Engineering Mathematics- ii
Question bank Engineering Mathematics- ii
 
Newton two Equation method
Newton two Equation  method Newton two Equation  method
Newton two Equation method
 
math1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfmath1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdf
 
Solution of matlab chapter 3
Solution of matlab chapter 3Solution of matlab chapter 3
Solution of matlab chapter 3
 
G e hay's
G e hay'sG e hay's
G e hay's
 
Counting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort AlgorithmsCounting Sort and Radix Sort Algorithms
Counting Sort and Radix Sort Algorithms
 
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291z
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291zSolutions manual for college algebra 10th edition by larson ibsn 9781337282291z
Solutions manual for college algebra 10th edition by larson ibsn 9781337282291z
 
Constant strain triangular
Constant strain triangular Constant strain triangular
Constant strain triangular
 
Perfect method for Frames
Perfect method for FramesPerfect method for Frames
Perfect method for Frames
 
T.I.M.E. JEE Advanced 2013 Solution Paper1
T.I.M.E. JEE Advanced 2013 Solution Paper1T.I.M.E. JEE Advanced 2013 Solution Paper1
T.I.M.E. JEE Advanced 2013 Solution Paper1
 
solution for 2D truss1
solution for 2D truss1solution for 2D truss1
solution for 2D truss1
 
3rd Semester Computer Science and Engineering (ACU - 2022) Question papers
3rd Semester Computer Science and Engineering  (ACU - 2022) Question papers3rd Semester Computer Science and Engineering  (ACU - 2022) Question papers
3rd Semester Computer Science and Engineering (ACU - 2022) Question papers
 
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
13200836 solution-manual-process-dynamics-and-control-donald-r-coughanowr-130...
 

More from Nikolai Priezjev

Rapid cooling across the glass transition temperature at finite strain rate
Rapid cooling across the glass transition temperature at finite strain rateRapid cooling across the glass transition temperature at finite strain rate
Rapid cooling across the glass transition temperature at finite strain rateNikolai Priezjev
 
Heterogeneous relaxation dynamics in amorphous materials under cyclic loading
Heterogeneous relaxation dynamics in amorphous materials under cyclic loadingHeterogeneous relaxation dynamics in amorphous materials under cyclic loading
Heterogeneous relaxation dynamics in amorphous materials under cyclic loadingNikolai Priezjev
 
Collective nonaffine rearrangements in binary glasses during large-amplitude ...
Collective nonaffine rearrangements in binary glasses during large-amplitude ...Collective nonaffine rearrangements in binary glasses during large-amplitude ...
Collective nonaffine rearrangements in binary glasses during large-amplitude ...Nikolai Priezjev
 
Molecular dynamics simulation study of a polymer droplet motion over an array...
Molecular dynamics simulation study of a polymer droplet motion over an array...Molecular dynamics simulation study of a polymer droplet motion over an array...
Molecular dynamics simulation study of a polymer droplet motion over an array...Nikolai Priezjev
 
Lecture Statics Analysis of Trusses
Lecture Statics Analysis of TrussesLecture Statics Analysis of Trusses
Lecture Statics Analysis of TrussesNikolai Priezjev
 
Lecture Statics Moments of Forces
Lecture Statics Moments of ForcesLecture Statics Moments of Forces
Lecture Statics Moments of ForcesNikolai Priezjev
 
Dynamics Instantaneous center of zero velocity
Dynamics Instantaneous center of zero velocityDynamics Instantaneous center of zero velocity
Dynamics Instantaneous center of zero velocityNikolai Priezjev
 
Dynamics Kinematics Curvilinear Motion
Dynamics Kinematics Curvilinear MotionDynamics Kinematics Curvilinear Motion
Dynamics Kinematics Curvilinear MotionNikolai Priezjev
 
Lecture: Ensembles and free energy in Monte Carlo simulations
Lecture: Ensembles and free energy in Monte Carlo simulationsLecture: Ensembles and free energy in Monte Carlo simulations
Lecture: Ensembles and free energy in Monte Carlo simulationsNikolai Priezjev
 
Lecture: Solidification and Growth Kinetics
Lecture: Solidification and Growth KineticsLecture: Solidification and Growth Kinetics
Lecture: Solidification and Growth KineticsNikolai Priezjev
 
Lecture: Crystal Interfaces and Microstructure
Lecture: Crystal Interfaces and MicrostructureLecture: Crystal Interfaces and Microstructure
Lecture: Crystal Interfaces and MicrostructureNikolai Priezjev
 
Lecture: Diffusion in Metals and Alloys
Lecture: Diffusion in Metals and AlloysLecture: Diffusion in Metals and Alloys
Lecture: Diffusion in Metals and AlloysNikolai Priezjev
 
Lecture: Binary phase diagrams and Gibbs free energy curves
Lecture: Binary phase diagrams and Gibbs free energy curvesLecture: Binary phase diagrams and Gibbs free energy curves
Lecture: Binary phase diagrams and Gibbs free energy curvesNikolai Priezjev
 
Lecture: Polymer Processing
Lecture: Polymer Processing Lecture: Polymer Processing
Lecture: Polymer Processing Nikolai Priezjev
 
Lecture: Dynamics of Polymer Solutions and Melts
Lecture: Dynamics of Polymer Solutions and Melts Lecture: Dynamics of Polymer Solutions and Melts
Lecture: Dynamics of Polymer Solutions and Melts Nikolai Priezjev
 
Lecture: Mechanical Properties: Macro Viewpoint
Lecture: Mechanical Properties: Macro ViewpointLecture: Mechanical Properties: Macro Viewpoint
Lecture: Mechanical Properties: Macro ViewpointNikolai Priezjev
 
Lecture: Microstructures in polymers
Lecture: Microstructures in polymersLecture: Microstructures in polymers
Lecture: Microstructures in polymersNikolai Priezjev
 
Lecture: Polymerization Reactions and Techniques
Lecture: Polymerization Reactions and TechniquesLecture: Polymerization Reactions and Techniques
Lecture: Polymerization Reactions and TechniquesNikolai Priezjev
 
Lecture: Polymeric Materials: Molecular Viewpoint
Lecture: Polymeric Materials: Molecular ViewpointLecture: Polymeric Materials: Molecular Viewpoint
Lecture: Polymeric Materials: Molecular ViewpointNikolai Priezjev
 
Molecular origin of surface tension at liquid-vapor interfaces
Molecular origin of surface tension at liquid-vapor interfacesMolecular origin of surface tension at liquid-vapor interfaces
Molecular origin of surface tension at liquid-vapor interfacesNikolai Priezjev
 

More from Nikolai Priezjev (20)

Rapid cooling across the glass transition temperature at finite strain rate
Rapid cooling across the glass transition temperature at finite strain rateRapid cooling across the glass transition temperature at finite strain rate
Rapid cooling across the glass transition temperature at finite strain rate
 
Heterogeneous relaxation dynamics in amorphous materials under cyclic loading
Heterogeneous relaxation dynamics in amorphous materials under cyclic loadingHeterogeneous relaxation dynamics in amorphous materials under cyclic loading
Heterogeneous relaxation dynamics in amorphous materials under cyclic loading
 
Collective nonaffine rearrangements in binary glasses during large-amplitude ...
Collective nonaffine rearrangements in binary glasses during large-amplitude ...Collective nonaffine rearrangements in binary glasses during large-amplitude ...
Collective nonaffine rearrangements in binary glasses during large-amplitude ...
 
Molecular dynamics simulation study of a polymer droplet motion over an array...
Molecular dynamics simulation study of a polymer droplet motion over an array...Molecular dynamics simulation study of a polymer droplet motion over an array...
Molecular dynamics simulation study of a polymer droplet motion over an array...
 
Lecture Statics Analysis of Trusses
Lecture Statics Analysis of TrussesLecture Statics Analysis of Trusses
Lecture Statics Analysis of Trusses
 
Lecture Statics Moments of Forces
Lecture Statics Moments of ForcesLecture Statics Moments of Forces
Lecture Statics Moments of Forces
 
Dynamics Instantaneous center of zero velocity
Dynamics Instantaneous center of zero velocityDynamics Instantaneous center of zero velocity
Dynamics Instantaneous center of zero velocity
 
Dynamics Kinematics Curvilinear Motion
Dynamics Kinematics Curvilinear MotionDynamics Kinematics Curvilinear Motion
Dynamics Kinematics Curvilinear Motion
 
Lecture: Ensembles and free energy in Monte Carlo simulations
Lecture: Ensembles and free energy in Monte Carlo simulationsLecture: Ensembles and free energy in Monte Carlo simulations
Lecture: Ensembles and free energy in Monte Carlo simulations
 
Lecture: Solidification and Growth Kinetics
Lecture: Solidification and Growth KineticsLecture: Solidification and Growth Kinetics
Lecture: Solidification and Growth Kinetics
 
Lecture: Crystal Interfaces and Microstructure
Lecture: Crystal Interfaces and MicrostructureLecture: Crystal Interfaces and Microstructure
Lecture: Crystal Interfaces and Microstructure
 
Lecture: Diffusion in Metals and Alloys
Lecture: Diffusion in Metals and AlloysLecture: Diffusion in Metals and Alloys
Lecture: Diffusion in Metals and Alloys
 
Lecture: Binary phase diagrams and Gibbs free energy curves
Lecture: Binary phase diagrams and Gibbs free energy curvesLecture: Binary phase diagrams and Gibbs free energy curves
Lecture: Binary phase diagrams and Gibbs free energy curves
 
Lecture: Polymer Processing
Lecture: Polymer Processing Lecture: Polymer Processing
Lecture: Polymer Processing
 
Lecture: Dynamics of Polymer Solutions and Melts
Lecture: Dynamics of Polymer Solutions and Melts Lecture: Dynamics of Polymer Solutions and Melts
Lecture: Dynamics of Polymer Solutions and Melts
 
Lecture: Mechanical Properties: Macro Viewpoint
Lecture: Mechanical Properties: Macro ViewpointLecture: Mechanical Properties: Macro Viewpoint
Lecture: Mechanical Properties: Macro Viewpoint
 
Lecture: Microstructures in polymers
Lecture: Microstructures in polymersLecture: Microstructures in polymers
Lecture: Microstructures in polymers
 
Lecture: Polymerization Reactions and Techniques
Lecture: Polymerization Reactions and TechniquesLecture: Polymerization Reactions and Techniques
Lecture: Polymerization Reactions and Techniques
 
Lecture: Polymeric Materials: Molecular Viewpoint
Lecture: Polymeric Materials: Molecular ViewpointLecture: Polymeric Materials: Molecular Viewpoint
Lecture: Polymeric Materials: Molecular Viewpoint
 
Molecular origin of surface tension at liquid-vapor interfaces
Molecular origin of surface tension at liquid-vapor interfacesMolecular origin of surface tension at liquid-vapor interfaces
Molecular origin of surface tension at liquid-vapor interfaces
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 

Numerical Methods: Solution of system of equations

  • 1. ME4010 Computational Methods for Mechanical Engineering Chapter 4 Solution of system of equations Instructor: Nikolai V. Priezjev Office: 430 Russ Engineering Center Phone: 937-775-3214 Email: nikolai.priezjev@wright.edu The course is adopted from Prof. Huang at WSU
  • 2.     )( 2)( 2 23332 2 3 1222322 2 2 111212 2 1 xxkgmx dt d m xxkgmxxkx dt d m kxgmxxkx dt d m    1 2 1 1 2 3 2 2 3 3 3 2 0 2 3 0 kx kx m g kx kx kx m g kx kx m g           The steady state equations are: 1 1 2 2 3 3 3 2 0 2 3 0 k k x m g k k k x m g k k x m g                               In matrix form: Dynamics
  • 3. Statics R1 + T1 cos 60 + T2 = 0 R2 + T1 sin 60 = 0 -T2 -T3 cos 60 + T4 cos 60 + T5 = 0 T3 sin 60 + T4 sin 60 = 0 -T5 - T6 cos 60 = 0 T6 sin 60 + R3 = 0 -T1 cos 60 + T3 cos 60 + T7 - F1 cos = 0 -T1 sin 60 - T3 sin 60 - F1 sin= 0 -T4 cos 60 - T7 + T6 cos 60 - F2 cos  = 0 -T4 sin 60 - T6 sin 60 - F2 sin = 0
  • 4. In matrix form 1 cos60 1 0 0 0 0 0 0 0 0 sin60 0 1 0 0 0 0 0 0 0 0 1 0 cos60 cos60 1 0 0 0 0 0 0 0 sin60 sin60 0 0 0 0 0 0 0 0 0 0 1 cos60 0 0 0 0 0 0 0 0 0 sin60 1 0 0 cos60 0 0 cos60 0 0 0 0 1 0 sin60 0 0 sin60 0 0 0 0 0 0 0 0 0 0 cos60 0 cos60 0 1 0 0 0 0 0 sin60 0 sin60 0 0                                1 1 2 2 3 4 5 1 1 6 1 1 3 2 2 7 2 2 0 0 0 0 0 0 cos sin cos sin R T T R T T T F T F R F T F                                                                    
  • 5. Circuit 1 2 3 4 9 4 2 0 24 4 17 6 3 16 2 6 14 6 0 0 3 6 11 18 i i i i                                      V = I * R 1: i1*9 - i2*4 - i3*2 = 24
  • 6. Method [A] = [L][U] where [L] = lower triangular matrix [U] = upper triangular matrix LU Decomposition Given [A][X] = [B] 1. Decompose [A] into [L] and [U] 2. Solve [L][Z] = [B] for [Z] 3. Solve [U][X] = [Z] for [X]
  • 7. Method: [A] Decomposes to [L] and [U]                           33 2322 131211 3231 21 00 0 1 01 001 u uu uuu ULA   [U] is the same as the coefficient matrix at the end of the forward elimination step. [L] is obtained using the multipliers that were used in the forward elimination process
  • 8. Finding the [U] matrix Using the Forward Elimination Procedure of Gauss Elimination 112144 1864 1525             112144 56.18.40 1525 56.212;56.2 25 64            RowRow   76.48.160 56.18.40 1525 76.513;76.5 25 144             RowRow Step 1:
  • 9. Finding the [U] Matrix Step 2:             76.48.160 56.18.40 1525   7.000 56.18.40 1525 5.323;5.3 8.4 8.16              RowRow              7.000 56.18.40 1525 U Matrix after Step 1:
  • 10. Finding the [L] matrix Using the multipliers used during the Forward Elimination Procedure           1 01 001 3231 21   56.2 25 64 11 21 21  a a  76.5 25 144 11 31 31  a a  From the first step of forward elimination 112144 1864 1525          
  • 11. Finding the [L] Matrix              15.376.5 0156.2 001 L From the second step of forward elimination             76.48.160 56.18.40 1525 5.3 8.4 8.16 22 32 32     a a 
  • 12. Does [L][U] = [A]?                           7.000 56.18.40 1525 15.376.5 0156.2 001 UL ? 112144 1864 1525          
  • 13. Try this… 4 2 3 6 6 7 6.5 6 1 7.5 6.25 5.5 12 22 15.5 1              
  • 14. Using LU Decomposition to solve SLEs Solve the following set of linear equations using LU Decomposition                                2279 2177 8106 112144 1864 1525 3 2 1 . . . x x x Using the procedure for finding the [L] and [U] matrices                            7.000 56.18.40 1525 15.376.5 0156.2 001 ULA
  • 15. Example Set [L][Z] = [B] Solve for [Z]                                2.279 2.177 8.106 15.376.5 0156.2 001 3 2 1 z z z 1 1 2 1 2 3 106.8 2.56 177.2 5.76 3.5 279.2 z z z z z z      
  • 16. Example Complete the forward substitution to solve for [Z]       735.0 21.965.38.10676.52.279 5.376.52.279 2.96 8.10656.22.177 56.22.177 8.106 213 12 1        zzz zz z                         735.0 21.96 8.106 3 2 1 z z z Z
  • 17. Example Set [U][X] = [Z] Solve for [X] The 3 equations become                                 7350 2196 8106 7.000 56.18.40 1525 3 2 1 . . . x x x 1 2 3 2 3 3 25 5 106.8 4.8 1.56 96.21 0.7 0.735 x x x x x x        
  • 18. Example From the 3rd equation 3 3 3 0 7 0 735 0 735 0 7 1 050 . x . . x . x .    Substituting in a3 and using the second equation 2 34 8 1 56 96 21. x . x .      3 2 2 2 96 21 1 56 4 8 96 21 1 56 1 050 4 8 19 70 . . x x . . . . x . x .         
  • 19. Example Substituting in a3 and a2 using the first equation 1 2 325 5 106 8x x x .   Hence the Solution Vector is: 1 2 3 0.2900 19.70 1.050 x x x                    2 3 1 106 8 5 25 106 8 5 19 70 1 050 25 0 2900 . x x x . . . .       
  • 20. Try this… 1 2 3 4 4 2 3 6 12 6 7 6.5 6 6.5 1 7.5 6.25 5.5 16 12 22 15.5 1 17 x x x x                                  
  • 21. Module LU_solver Contains ! SUBROUTINE TO PERFORM DOLITTLE FACTORIZATION: A=LU SUBROUTINE LU(N,A,B,X) integer::N,I,j,k double precision:: A(N,N),L(N,N),U(N,N),B(N),Z(N),X(N) double precision:: S,S1,S2,SS,S3,S4 DO I = 1,N L(I,I)=1. ENDDO U(1,1)=A(1,1) IF(U(1,1).EQ.0.)THEN WRITE(1,*)'LU FACTORIZATION IS IMPOSSIBLE' RETURN ENDIF DO J =2,N U(1,J)=A(1,J) ! DETERMINE THE FIRST ROW OF U L(J,1)=A(J,1)/U(1,1) ! DETERMINE THE FIRST COLUMN OF XL ENDDO DO I = 2, N-1 S=0. DO K = 1, I-1 S=S+L(I,K)*U(K,I) ENDDO U(I,I)= A(I,I)-S IF(U(I,I).EQ.0.)THEN WRITE(1,*)'LU FACTORIZATION IS IMPOSSIBLE' RETURN ENDIF DO J = I+1, N S1=0. S2=0. DO K = 1, I-1 S1=S1+L(I,K)*U(K,J) ! DETERMINE THE (ith) ROWS OF U S2=S2+L(J,K)*U(K,I) ! DETERMINE THE (ith) COLUMN OF XL U(I,J)=A(I,J)-S1 L(J,I)=(A(J,I)-S2)/U(I,I) ENDDO ENDDO ENDDO SS=0 DO K = 1,N-1 SS=SS+L(N,K)*U(K,N) U(N,N)=A(N,N)-SS ENDDO IF(U(N,N).EQ.0) THEN WRITE(1,*)' THE MATRIX A IS SINQULAR' ENDIF ! SUBROUTINE TO SOLVE LZ=B USING FORWARD SUBSTITUTION Z(1)=B(1) DO I =2,N S3=0. DO J =1,I-1 S3=S3+L(I,J)*Z(J) ENDDO Z(I)=B(I)-S3 ENDDO X(N)=Z(N)/U(N,N) DO K = N-1,1,-1 ! SOLVING UX=Z S4=0. DO J=K+1,N S4=S4+U(K,J)*X(J) ENDDO X(K)=(Z(K)-S4)/U(K,K) ENDDO RETURN END subroutine LU end module solver
  • 22. program main use LU_solver double precision, dimension(4,4)::A double precision, dimension (4)::B,X integer::i,j,N=4 open (1, file='matrix.dat') do i=1,n read(1,*)(a(i,j),J=1,N) enddo read(1,*)B call LU(N,A,B,X) print *,x stop end program main 4. -2. -3. 6. -6. 7. 6.5 -6. 1. 7.5 6.25 5.5 -12. 22. 15.5 -1. 12. -6.5 16. 17. matrix.dat file 1 2 3 4 4 2 3 6 12 6 7 6.5 6 6.5 1 7.5 6.25 5.5 16 12 22 15.5 1 17 x x x x                                  