SlideShare a Scribd company logo
SCIENTIFIC COMPUTING
Programming language used – MATLAB
Saurabh S. Ramteke
Contents
Gauss Elimination......................................................................................................................... 2
LU decomp...................................................................................................................................3
Gram Schmidt.............................................................................................................................. 4
QR............................................................................................................................................... 5
Choleski.......................................................................................................................................6
Shooting using secant................................................................................................................... 7
Gauss Elimination
%% Double for loop
clear all; clc;
%% Equatiions AX = b
A = [12 -2 3; 1 10 -2; 3 1 15];
b = [18 16 52];
%% Initilization
n = length(A);
%% Gauss
for i = 1 : (n-1)
for j = n:-1 : i+1
m = A(j,i) / A(i,i);
A(j,:) = A(j,:) - m * A(i,:);
b(j) = b(j) - m * b(i);
end
end
%% Back - Substitution
x = zeros(n,1);
x(n) = b(n)/A(n,n);
for j = n-1:-1:1
sum = 0;
for i = n:-1:j+1
sum = sum + A(j,i)*x(i);
end
x(j) = (b(j)- sum)/A(j,j);
end
LU decomp
clc;
clear all;
%% Initialization
A = [1 2 3;
4 5 6;
7 8 9];
b = [1 2 3]';
%% Computation
[L,U] = lu(A);
% Ax = b => LUx=b => Ux = z
z = Lb;
x = Uz;
Gram Schmidt
V = [1 1 1 1;
1 2 4 5;
1 -3 -4 -2];
n = 3;
sum = 0;
for i = 1: n
A = V(:,i);
for j = 1: n
d = V(:,j) .* V(:,j);
n = V(:,j) .* A;
sum = sum + (n' / d') .* V(:,j);
end
B = A - sum;
q = norm(B);
q1 = B/q;
Q(:,i) = q1;
end
QR
A = [1 2 0;
0 1 1;
1 0 1];
n = 3;
for j =1 : n
v = A(:,j);
for i=1 : j-1
R(i,j) = Q(:,i)' * A(:,j);
v = v - R(i,j)*Q(:,i);
end
R(j,j) = norm(v);
Q(:,j) = v/R(j,j);
end
Choleski
clc;
clear all;
%% Initialization
A = [4 -1 -1;
-1 4 -3;
-1 -3 5];
b = [3 -0.5 0]';
%% Computation -
U = chol(A); % upper traiagular matrix
z = U'b; % U(U'X) = b => U'z = b
x = Uz; % Ux = z
Shooting using secant
clc;
clear all;
%% Initiliazation
h = 1/3;
a0 = 1.2; a1 = 1.5;
y_soln = 5;
% fn - y'' = 6y^2 - x
%% IVP 1
ys1 = 1;
zs1 = 1.2;
x1 = 0;
for i = 0:2
y1 = ys1 + h*zs1;
z1 = zs1 + h*(6*(ys1^2) - x1);
ys1 = y1;
zs1 = z1;
x1 = x1 + h;
end
%% IVP 2
ys2 = 1;
zs2 = 1.5;
x2 = 0;
for i = 0:2
y2 = ys2 + h*zs2;
z2 = zs2 + h*(6*(ys2^2) - x2);
ys2 = y2;
zs2 = z2;
x2 = x2 + h;
end
%% ph
phi_a0 = abs( y_soln - y1) ;
phi_a1 = abs( y_soln - y2) ;
%% a2
a2 = a1 - (a1 - a0)*phi_a1/(phi_a1 - phi_a0);

More Related Content

Similar to Scientific Computing

A Course in Fuzzy Systems and Control Matlab Chapter Four
A Course in Fuzzy Systems and Control Matlab Chapter FourA Course in Fuzzy Systems and Control Matlab Chapter Four
A Course in Fuzzy Systems and Control Matlab Chapter Four
Chung Hua Universit
 
AVR Instruction Set Manual.pdf
AVR Instruction Set Manual.pdfAVR Instruction Set Manual.pdf
AVR Instruction Set Manual.pdf
Modesto33
 
Report of the Implementation of DAE Integrators for MBSim
Report of the Implementation of DAE Integrators for MBSimReport of the Implementation of DAE Integrators for MBSim
Report of the Implementation of DAE Integrators for MBSim
Zhan Wang
 
PPG_FSK.pdf
PPG_FSK.pdfPPG_FSK.pdf
PPG_FSK.pdf
ShawkatOsmanShishir
 
Www.kutub.info 9472
Www.kutub.info 9472Www.kutub.info 9472
Www.kutub.info 9472
Firas Abdulateef
 
Identification of the Mathematical Models of Complex Relaxation Processes in ...
Identification of the Mathematical Models of Complex Relaxation Processes in ...Identification of the Mathematical Models of Complex Relaxation Processes in ...
Identification of the Mathematical Models of Complex Relaxation Processes in ...
Vladimir Bakhrushin
 
Financialmodeling
FinancialmodelingFinancialmodeling
Financialmodeling
Talal Tahir
 
A Course in Fuzzy Systems and Control Matlab Chapter Three
A Course in Fuzzy Systems and Control Matlab Chapter ThreeA Course in Fuzzy Systems and Control Matlab Chapter Three
A Course in Fuzzy Systems and Control Matlab Chapter Three
Chung Hua Universit
 
3 (a) calculate thy potential at point P located a distance z above .pdf
 3 (a) calculate thy potential at point P located a distance z above  .pdf 3 (a) calculate thy potential at point P located a distance z above  .pdf
3 (a) calculate thy potential at point P located a distance z above .pdf
Info489948
 
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
Maho Nakata
 
Cookbook en
Cookbook enCookbook en
Cookbook en
Sankarshan Deb
 
8051 micro controller
8051 micro controller8051 micro controller
8051 micro controller
Arun Umrao
 
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
ssuserd6b1fd
 
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdfreservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
RTEFGDFGJU
 
Numericam Methods using Matlab.pdf
Numericam Methods using Matlab.pdfNumericam Methods using Matlab.pdf
Numericam Methods using Matlab.pdf
Dhiraj Bhaskar
 
Digital control book
Digital control bookDigital control book
Digital control book
cairo university
 
Mpc 006 - 02-03 partial and multiple correlation
Mpc 006 - 02-03 partial and multiple correlationMpc 006 - 02-03 partial and multiple correlation
Mpc 006 - 02-03 partial and multiple correlation
Vasant Kothari
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
thesaqib
 
Lecture 07+08_1st & 2nd Order Control Systems (1).pptx
Lecture 07+08_1st & 2nd Order Control Systems (1).pptxLecture 07+08_1st & 2nd Order Control Systems (1).pptx
Lecture 07+08_1st & 2nd Order Control Systems (1).pptx
FaheemAbbas82
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
eyewatchsystems
 

Similar to Scientific Computing (20)

A Course in Fuzzy Systems and Control Matlab Chapter Four
A Course in Fuzzy Systems and Control Matlab Chapter FourA Course in Fuzzy Systems and Control Matlab Chapter Four
A Course in Fuzzy Systems and Control Matlab Chapter Four
 
AVR Instruction Set Manual.pdf
AVR Instruction Set Manual.pdfAVR Instruction Set Manual.pdf
AVR Instruction Set Manual.pdf
 
Report of the Implementation of DAE Integrators for MBSim
Report of the Implementation of DAE Integrators for MBSimReport of the Implementation of DAE Integrators for MBSim
Report of the Implementation of DAE Integrators for MBSim
 
PPG_FSK.pdf
PPG_FSK.pdfPPG_FSK.pdf
PPG_FSK.pdf
 
Www.kutub.info 9472
Www.kutub.info 9472Www.kutub.info 9472
Www.kutub.info 9472
 
Identification of the Mathematical Models of Complex Relaxation Processes in ...
Identification of the Mathematical Models of Complex Relaxation Processes in ...Identification of the Mathematical Models of Complex Relaxation Processes in ...
Identification of the Mathematical Models of Complex Relaxation Processes in ...
 
Financialmodeling
FinancialmodelingFinancialmodeling
Financialmodeling
 
A Course in Fuzzy Systems and Control Matlab Chapter Three
A Course in Fuzzy Systems and Control Matlab Chapter ThreeA Course in Fuzzy Systems and Control Matlab Chapter Three
A Course in Fuzzy Systems and Control Matlab Chapter Three
 
3 (a) calculate thy potential at point P located a distance z above .pdf
 3 (a) calculate thy potential at point P located a distance z above  .pdf 3 (a) calculate thy potential at point P located a distance z above  .pdf
3 (a) calculate thy potential at point P located a distance z above .pdf
 
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
quantum chemistry on quantum computer handson by Q# (2019/8/4@MDR Hongo, Tokyo)
 
Cookbook en
Cookbook enCookbook en
Cookbook en
 
8051 micro controller
8051 micro controller8051 micro controller
8051 micro controller
 
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
Notes of 8051 Micro Controller for BCA, MCA, MSC (CS), MSC (IT) & AMIE IEI- b...
 
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdfreservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
reservoir-modeling-using-matlab-the-matalb-reservoir-simulation-toolbox-mrst.pdf
 
Numericam Methods using Matlab.pdf
Numericam Methods using Matlab.pdfNumericam Methods using Matlab.pdf
Numericam Methods using Matlab.pdf
 
Digital control book
Digital control bookDigital control book
Digital control book
 
Mpc 006 - 02-03 partial and multiple correlation
Mpc 006 - 02-03 partial and multiple correlationMpc 006 - 02-03 partial and multiple correlation
Mpc 006 - 02-03 partial and multiple correlation
 
Lab manual of C++
Lab manual of C++Lab manual of C++
Lab manual of C++
 
Lecture 07+08_1st & 2nd Order Control Systems (1).pptx
Lecture 07+08_1st & 2nd Order Control Systems (1).pptxLecture 07+08_1st & 2nd Order Control Systems (1).pptx
Lecture 07+08_1st & 2nd Order Control Systems (1).pptx
 
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdfI need help understanding the Pan Tompkins algorythm, and Id also .pdf
I need help understanding the Pan Tompkins algorythm, and Id also .pdf
 

More from saurabhramteke7

Design of experiments and stochastic process
Design of experiments and stochastic processDesign of experiments and stochastic process
Design of experiments and stochastic process
saurabhramteke7
 
Linear regressions
Linear regressionsLinear regressions
Linear regressions
saurabhramteke7
 
curve fitting
curve fittingcurve fitting
curve fitting
saurabhramteke7
 
Computer oriented optimization
Computer oriented optimizationComputer oriented optimization
Computer oriented optimization
saurabhramteke7
 
Scientific Computing
Scientific ComputingScientific Computing
Scientific Computing
saurabhramteke7
 
UPSC Mnemonic for quick revision
UPSC Mnemonic for quick revisionUPSC Mnemonic for quick revision
UPSC Mnemonic for quick revision
saurabhramteke7
 

More from saurabhramteke7 (6)

Design of experiments and stochastic process
Design of experiments and stochastic processDesign of experiments and stochastic process
Design of experiments and stochastic process
 
Linear regressions
Linear regressionsLinear regressions
Linear regressions
 
curve fitting
curve fittingcurve fitting
curve fitting
 
Computer oriented optimization
Computer oriented optimizationComputer oriented optimization
Computer oriented optimization
 
Scientific Computing
Scientific ComputingScientific Computing
Scientific Computing
 
UPSC Mnemonic for quick revision
UPSC Mnemonic for quick revisionUPSC Mnemonic for quick revision
UPSC Mnemonic for quick revision
 

Recently uploaded

Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
blueshagoo1
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
z6osjkqvd
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
Vietnam Cotton & Spinning Association
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 
一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理
keesa2
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
Vineet
 
A gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented GenerationA gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented Generation
dataschool1
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
eoxhsaa
 
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
Rebecca Bilbro
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
zsafxbf
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
TeukuEriSyahputra
 
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
agdhot
 
社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .
NABLAS株式会社
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
yuvarajkumar334
 
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
osoyvvf
 
Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)
GeorgiiSteshenko
 
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
mbawufebxi
 
Sample Devops SRE Product Companies .pdf
Sample Devops SRE  Product Companies .pdfSample Devops SRE  Product Companies .pdf
Sample Devops SRE Product Companies .pdf
Vineet
 

Recently uploaded (20)

Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics May 2024
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 
一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理一比一原版悉尼大学毕业证如何办理
一比一原版悉尼大学毕业证如何办理
 
Data Scientist Machine Learning Profiles .pdf
Data Scientist Machine Learning  Profiles .pdfData Scientist Machine Learning  Profiles .pdf
Data Scientist Machine Learning Profiles .pdf
 
A gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented GenerationA gentle exploration of Retrieval Augmented Generation
A gentle exploration of Retrieval Augmented Generation
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
 
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
PyData London 2024: Mistakes were made (Dr. Rebecca Bilbro)
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理一比一原版莱斯大学毕业证(rice毕业证)如何办理
一比一原版莱斯大学毕业证(rice毕业证)如何办理
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
 
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
一比一原版加拿大麦吉尔大学毕业证(mcgill毕业证书)如何办理
 
社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .社内勉強会資料_Hallucination of LLMs               .
社内勉強会資料_Hallucination of LLMs               .
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
 
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
一比一原版(uom毕业证书)曼彻斯特大学毕业证如何办理
 
Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)Telemetry Solution for Gaming (AWS Summit'24)
Telemetry Solution for Gaming (AWS Summit'24)
 
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
一比一原版雷丁大学毕业证(UoR毕业证书)学历如何办理
 
Sample Devops SRE Product Companies .pdf
Sample Devops SRE  Product Companies .pdfSample Devops SRE  Product Companies .pdf
Sample Devops SRE Product Companies .pdf
 

Scientific Computing

  • 1. SCIENTIFIC COMPUTING Programming language used – MATLAB Saurabh S. Ramteke
  • 2. Contents Gauss Elimination......................................................................................................................... 2 LU decomp...................................................................................................................................3 Gram Schmidt.............................................................................................................................. 4 QR............................................................................................................................................... 5 Choleski.......................................................................................................................................6 Shooting using secant................................................................................................................... 7
  • 3. Gauss Elimination %% Double for loop clear all; clc; %% Equatiions AX = b A = [12 -2 3; 1 10 -2; 3 1 15]; b = [18 16 52]; %% Initilization n = length(A); %% Gauss for i = 1 : (n-1) for j = n:-1 : i+1 m = A(j,i) / A(i,i); A(j,:) = A(j,:) - m * A(i,:); b(j) = b(j) - m * b(i); end end %% Back - Substitution x = zeros(n,1); x(n) = b(n)/A(n,n); for j = n-1:-1:1 sum = 0; for i = n:-1:j+1 sum = sum + A(j,i)*x(i); end x(j) = (b(j)- sum)/A(j,j); end
  • 4. LU decomp clc; clear all; %% Initialization A = [1 2 3; 4 5 6; 7 8 9]; b = [1 2 3]'; %% Computation [L,U] = lu(A); % Ax = b => LUx=b => Ux = z z = Lb; x = Uz;
  • 5. Gram Schmidt V = [1 1 1 1; 1 2 4 5; 1 -3 -4 -2]; n = 3; sum = 0; for i = 1: n A = V(:,i); for j = 1: n d = V(:,j) .* V(:,j); n = V(:,j) .* A; sum = sum + (n' / d') .* V(:,j); end B = A - sum; q = norm(B); q1 = B/q; Q(:,i) = q1; end
  • 6. QR A = [1 2 0; 0 1 1; 1 0 1]; n = 3; for j =1 : n v = A(:,j); for i=1 : j-1 R(i,j) = Q(:,i)' * A(:,j); v = v - R(i,j)*Q(:,i); end R(j,j) = norm(v); Q(:,j) = v/R(j,j); end
  • 7. Choleski clc; clear all; %% Initialization A = [4 -1 -1; -1 4 -3; -1 -3 5]; b = [3 -0.5 0]'; %% Computation - U = chol(A); % upper traiagular matrix z = U'b; % U(U'X) = b => U'z = b x = Uz; % Ux = z
  • 8. Shooting using secant clc; clear all; %% Initiliazation h = 1/3; a0 = 1.2; a1 = 1.5; y_soln = 5; % fn - y'' = 6y^2 - x %% IVP 1 ys1 = 1; zs1 = 1.2; x1 = 0; for i = 0:2 y1 = ys1 + h*zs1; z1 = zs1 + h*(6*(ys1^2) - x1); ys1 = y1; zs1 = z1; x1 = x1 + h; end %% IVP 2 ys2 = 1; zs2 = 1.5; x2 = 0; for i = 0:2 y2 = ys2 + h*zs2; z2 = zs2 + h*(6*(ys2^2) - x2); ys2 = y2; zs2 = z2; x2 = x2 + h; end %% ph phi_a0 = abs( y_soln - y1) ; phi_a1 = abs( y_soln - y2) ; %% a2 a2 = a1 - (a1 - a0)*phi_a1/(phi_a1 - phi_a0);