SlideShare a Scribd company logo
1 of 4
Assignment (3)


Q1. Solve the integral                          using paper and pen or calculator, and
then compare the answer to the computational method using the Romberg method.

Solution



= [x6 /6 + x5 /5 + x4/ 4 + ex]

={ [1/6 (4)6 + 1/5 (4)5 + 1/4(4)4 + e4] –[1/6 (0.5)6 + 1/5 (0.5)5 + 1/4(0.5)4 + e5] }

= (1006.06) –(1.752865) = 1004.3071



function [q,ea,iter]=romberg(func,a,b,es,maxit,varargin)
% if nargin<3,error('at least 3arguments required'),end
if nargin<4||isempty(es),es=0.000001;end
if nargin<5||isempty(maxit),maxit=50;end
n=1;
r(1,1) = trap(func,a,b,n,varargin{:});
iter=0;
while iter<maxit
   iter=iter+1;
   n=2^iter;
   I(iter+1,1)=trap(func,a,b,n,varargin{:});
   for k=2:iter+1
      j=2+iter-k;
      I(j,k)=(4^(k-1)*I(j+1,k-1)-I(j,k-1))/(4^(k-1)-1);
   end
   ea=abs((I(1,iter+1)-I(2,iter))/I(1,iter+1))*100;
   if ea<=es, break; end
end
q=I(1,iter+1);



function I=trap(func,a,b,n,varargin)
if(nargin<3)
   error('at least 3 input arguments required');
end
if ~(b>a),error('upper bound must be greater than lower'),end
if nargin<4||isempty(n),n=100;end

  x=a; h=(b-a)/n;

    s=func(a,varargin{:});
      for i=1:n-1
        x=x+h;
     s=s+2*func(x,varargin{:});
   end
  s=s+func(b,varargin{:});
  I=(b-a)*s/(2*n);


>> f=@(x) x^5+x^4+x^3+exp(x);



>> romberg(f,0.5,4)



ans =



 1.0044e+003
Q2. Calculate the integral                    dt. The exact answer to this integral is
15.41260804810169. Solve the integral using the Romberg method



Solution


function [q,ea,iter]=romberg(func,a,b,es,maxit,varargin)
% if nargin<3,error('at least 3arguments required'),end
if nargin<4||isempty(es),es=0.000001;end
if nargin<5||isempty(maxit),maxit=50;end
n=1;
r(1,1) = trap(func,a,b,n,varargin{:});
iter=0;
while iter<maxit
   iter=iter+1;
   n=2^iter;
   I(iter+1,1)=trap(func,a,b,n,varargin{:});
   for k=2:iter+1



     j=2+iter-k;
     I(j,k)=(4^(k-1)*I(j+1,k-1)-I(j,k-1))/(4^(k-1)-1);
  end
  ea=abs((I(1,iter+1)-I(2,iter))/I(1,iter+1))*100;
  if ea<=es, break; end
end
q=I(1,iter+1);

function I=trap(func,a,b,n,varargin)
if(nargin<3)
   error('at least 3 input arguments required');
end
if ~(b>a),error('upper bound must be greater than lower'),end
if nargin<4||isempty(n),n=100;end
   x=a; h=(b-a)/n;
   s=func(a,varargin{:});
   for i=1:n-1
      x=x+h;
      s=s+2*func(x,varargin{:});
   end
   s=s+func(b,varargin{:});
   I=(b-a)*s/(2*n);
>> f=@(t) (10*exp(-t)*sin(2*pi*t))^2


>> romberg (f,0,0.5)


ans =


 15.4126

More Related Content

What's hot

Jan. 6 Inverse Functions
Jan. 6 Inverse FunctionsJan. 6 Inverse Functions
Jan. 6 Inverse FunctionsRyanWatt
 
Laplace periodic function
Laplace periodic functionLaplace periodic function
Laplace periodic functionKaushal Surti
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorAbhranil Das
 
Application of derivatives
Application of derivativesApplication of derivatives
Application of derivativesindu thakur
 
Application of differentiation
Application of differentiationApplication of differentiation
Application of differentiationLily Maryati
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONDhrupal Patel
 
Newton cotes integration method
Newton cotes integration  methodNewton cotes integration  method
Newton cotes integration methodshashikant pabari
 
application of partial differentiation
application of partial differentiationapplication of partial differentiation
application of partial differentiationeteaching
 
Math - Operations on Functions, Kinds of Functions
Math - Operations on Functions, Kinds of FunctionsMath - Operations on Functions, Kinds of Functions
Math - Operations on Functions, Kinds of FunctionsChuckie Balbuena
 
Lecture 18 antiderivatives - section 4.8
Lecture 18   antiderivatives - section 4.8Lecture 18   antiderivatives - section 4.8
Lecture 18 antiderivatives - section 4.8njit-ronbrown
 
5.7 rolle's thrm & mv theorem
5.7 rolle's thrm & mv theorem5.7 rolle's thrm & mv theorem
5.7 rolle's thrm & mv theoremdicosmo178
 
Inverse Functions
Inverse FunctionsInverse Functions
Inverse Functionsswartzje
 
Polynomial And Rational Funciotns 0921
Polynomial And Rational Funciotns 0921Polynomial And Rational Funciotns 0921
Polynomial And Rational Funciotns 0921ingroy
 

What's hot (20)

Jan. 6 Inverse Functions
Jan. 6 Inverse FunctionsJan. 6 Inverse Functions
Jan. 6 Inverse Functions
 
Laplace periodic function
Laplace periodic functionLaplace periodic function
Laplace periodic function
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
 
Application of derivatives
Application of derivativesApplication of derivatives
Application of derivatives
 
Application of differentiation
Application of differentiationApplication of differentiation
Application of differentiation
 
Es272 ch6
Es272 ch6Es272 ch6
Es272 ch6
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATION
 
Newton cotes integration method
Newton cotes integration  methodNewton cotes integration  method
Newton cotes integration method
 
residue
residueresidue
residue
 
Taylor series
Taylor seriesTaylor series
Taylor series
 
application of partial differentiation
application of partial differentiationapplication of partial differentiation
application of partial differentiation
 
Math - Operations on Functions, Kinds of Functions
Math - Operations on Functions, Kinds of FunctionsMath - Operations on Functions, Kinds of Functions
Math - Operations on Functions, Kinds of Functions
 
Lecture 18 antiderivatives - section 4.8
Lecture 18   antiderivatives - section 4.8Lecture 18   antiderivatives - section 4.8
Lecture 18 antiderivatives - section 4.8
 
5.7 rolle's thrm & mv theorem
5.7 rolle's thrm & mv theorem5.7 rolle's thrm & mv theorem
5.7 rolle's thrm & mv theorem
 
Inverse Functions
Inverse FunctionsInverse Functions
Inverse Functions
 
Inverse functions
Inverse functionsInverse functions
Inverse functions
 
Polynomial And Rational Funciotns 0921
Polynomial And Rational Funciotns 0921Polynomial And Rational Funciotns 0921
Polynomial And Rational Funciotns 0921
 
Fourier series
Fourier series Fourier series
Fourier series
 
Lecture6
Lecture6Lecture6
Lecture6
 
Inverse Functions
Inverse FunctionsInverse Functions
Inverse Functions
 

Viewers also liked

Are you paying attention presentation assignment #2-a crash course in creativ...
Are you paying attention presentation assignment #2-a crash course in creativ...Are you paying attention presentation assignment #2-a crash course in creativ...
Are you paying attention presentation assignment #2-a crash course in creativ...Seth Schalet
 
1.2. pruebas de hipótesis de una muestra parte 2
1.2. pruebas de hipótesis de una muestra parte 21.2. pruebas de hipótesis de una muestra parte 2
1.2. pruebas de hipótesis de una muestra parte 2alexis cañez
 
сетевые информационные технологии
сетевые информационные технологиисетевые информационные технологии
сетевые информационные технологииLazzerChel
 
Demmons creative 2011_small
Demmons creative 2011_smallDemmons creative 2011_small
Demmons creative 2011_smallMichael Demmons
 
De kiemtra 1 tiết lop 10
De kiemtra 1 tiết lop 10De kiemtra 1 tiết lop 10
De kiemtra 1 tiết lop 10nhom05vb2
 
Sponsorship opportunities at big boys toys 2012
Sponsorship opportunities at big boys toys 2012Sponsorship opportunities at big boys toys 2012
Sponsorship opportunities at big boys toys 2012Big Boys Toys UAE
 
Autism training-powerpoint
Autism training-powerpointAutism training-powerpoint
Autism training-powerpointdenisebur
 
Experimental Design
Experimental DesignExperimental Design
Experimental Designcoachsmb05
 
Roseland proposal
Roseland proposalRoseland proposal
Roseland proposalandymag1
 
Epic poetry battles of history!
Epic poetry battles of history!Epic poetry battles of history!
Epic poetry battles of history!Amanda Villalobos
 
The Yammer Way - Our Product Development Approach
The Yammer Way - Our Product Development ApproachThe Yammer Way - Our Product Development Approach
The Yammer Way - Our Product Development Approachyann ARMAND
 

Viewers also liked (16)

Who said it
Who said itWho said it
Who said it
 
President powerpoint
President powerpointPresident powerpoint
President powerpoint
 
Bee
BeeBee
Bee
 
Are you paying attention presentation assignment #2-a crash course in creativ...
Are you paying attention presentation assignment #2-a crash course in creativ...Are you paying attention presentation assignment #2-a crash course in creativ...
Are you paying attention presentation assignment #2-a crash course in creativ...
 
Scars identify
Scars identifyScars identify
Scars identify
 
1.2. pruebas de hipótesis de una muestra parte 2
1.2. pruebas de hipótesis de una muestra parte 21.2. pruebas de hipótesis de una muestra parte 2
1.2. pruebas de hipótesis de una muestra parte 2
 
сетевые информационные технологии
сетевые информационные технологиисетевые информационные технологии
сетевые информационные технологии
 
Demmons creative 2011_small
Demmons creative 2011_smallDemmons creative 2011_small
Demmons creative 2011_small
 
De kiemtra 1 tiết lop 10
De kiemtra 1 tiết lop 10De kiemtra 1 tiết lop 10
De kiemtra 1 tiết lop 10
 
Sponsorship opportunities at big boys toys 2012
Sponsorship opportunities at big boys toys 2012Sponsorship opportunities at big boys toys 2012
Sponsorship opportunities at big boys toys 2012
 
Gg ppt
Gg pptGg ppt
Gg ppt
 
Autism training-powerpoint
Autism training-powerpointAutism training-powerpoint
Autism training-powerpoint
 
Experimental Design
Experimental DesignExperimental Design
Experimental Design
 
Roseland proposal
Roseland proposalRoseland proposal
Roseland proposal
 
Epic poetry battles of history!
Epic poetry battles of history!Epic poetry battles of history!
Epic poetry battles of history!
 
The Yammer Way - Our Product Development Approach
The Yammer Way - Our Product Development ApproachThe Yammer Way - Our Product Development Approach
The Yammer Way - Our Product Development Approach
 

Similar to Assignment 3

Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)Will Kurt
 
Tarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezTarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezSebastian Vasquez
 
Ejercicios Scilab Completo
Ejercicios Scilab CompletoEjercicios Scilab Completo
Ejercicios Scilab CompletoRicardo Grandas
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptxsaadhaq6
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programmingDamian T. Gordon
 
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docxMATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docxandreecapon
 
Introduction to Functional Programming with Haskell and JavaScript
Introduction to Functional Programming with Haskell and JavaScriptIntroduction to Functional Programming with Haskell and JavaScript
Introduction to Functional Programming with Haskell and JavaScriptWill Kurt
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfJeancarlosPatalasanc
 
Performance Portability Through Descriptive Parallelism
Performance Portability Through Descriptive ParallelismPerformance Portability Through Descriptive Parallelism
Performance Portability Through Descriptive ParallelismJeff Larkin
 
Programación funcional con Haskell
Programación funcional con HaskellProgramación funcional con Haskell
Programación funcional con HaskellSoftware Guru
 
Gamma beta functions-1
Gamma   beta functions-1Gamma   beta functions-1
Gamma beta functions-1Selvaraj John
 
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...Parhamsagharchi
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionElsayed Hemayed
 

Similar to Assignment 3 (20)

Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)Intro to Functional Programming Workshop (code4lib)
Intro to Functional Programming Workshop (code4lib)
 
Tarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian VasquezTarea De Scilab By Sebastian Vasquez
Tarea De Scilab By Sebastian Vasquez
 
Ejercicios Scilab Completo
Ejercicios Scilab CompletoEjercicios Scilab Completo
Ejercicios Scilab Completo
 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx
 
Taller De Scilab
Taller De ScilabTaller De Scilab
Taller De Scilab
 
Introduction to MatLab programming
Introduction to MatLab programmingIntroduction to MatLab programming
Introduction to MatLab programming
 
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docxMATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
MATLABAssignment 2Bracketing (Multiple Roots) (4)Bisection .docx
 
Primer Punto
Primer PuntoPrimer Punto
Primer Punto
 
Numerical Method for UOG mech stu prd by Abdrehman Ahmed
Numerical Method for UOG mech stu prd by Abdrehman Ahmed Numerical Method for UOG mech stu prd by Abdrehman Ahmed
Numerical Method for UOG mech stu prd by Abdrehman Ahmed
 
Numerical methods generating polynomial
Numerical methods generating polynomialNumerical methods generating polynomial
Numerical methods generating polynomial
 
Introduction to Functional Programming with Haskell and JavaScript
Introduction to Functional Programming with Haskell and JavaScriptIntroduction to Functional Programming with Haskell and JavaScript
Introduction to Functional Programming with Haskell and JavaScript
 
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdfSolucionario_de_Chapra_y_Canale_Quinta_E.pdf
Solucionario_de_Chapra_y_Canale_Quinta_E.pdf
 
Performance Portability Through Descriptive Parallelism
Performance Portability Through Descriptive ParallelismPerformance Portability Through Descriptive Parallelism
Performance Portability Through Descriptive Parallelism
 
Mit6 094 iap10_lec03
Mit6 094 iap10_lec03Mit6 094 iap10_lec03
Mit6 094 iap10_lec03
 
Programación funcional con Haskell
Programación funcional con HaskellProgramación funcional con Haskell
Programación funcional con Haskell
 
Sary
SarySary
Sary
 
Gamma beta functions-1
Gamma   beta functions-1Gamma   beta functions-1
Gamma beta functions-1
 
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...
NUMERICAL METHODS WITH MATLAB : bisection,mueller's,newton-raphson,false poin...
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selection
 
Millionways
MillionwaysMillionways
Millionways
 

Recently uploaded

Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewasmakika9823
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… Abridged
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… AbridgedLean: From Theory to Practice — One City’s (and Library’s) Lean Story… Abridged
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… AbridgedKaiNexus
 
Sales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessSales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessAggregage
 
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc.../:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...lizamodels9
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Roomdivyansh0kumar0
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...lizamodels9
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...lizamodels9
 
rishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfrishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfmuskan1121w
 
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCRsoniya singh
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 
Call Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any TimeCall Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any Timedelhimodelshub1
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 

Recently uploaded (20)

Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… Abridged
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… AbridgedLean: From Theory to Practice — One City’s (and Library’s) Lean Story… Abridged
Lean: From Theory to Practice — One City’s (and Library’s) Lean Story… Abridged
 
Sales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for SuccessSales & Marketing Alignment: How to Synergize for Success
Sales & Marketing Alignment: How to Synergize for Success
 
KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)
 
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc.../:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
 
rishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfrishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdf
 
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR
(8264348440) 🔝 Call Girls In Keshav Puram 🔝 Delhi NCR
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 
Call Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any TimeCall Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any Time
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 

Assignment 3

  • 1. Assignment (3) Q1. Solve the integral using paper and pen or calculator, and then compare the answer to the computational method using the Romberg method. Solution = [x6 /6 + x5 /5 + x4/ 4 + ex] ={ [1/6 (4)6 + 1/5 (4)5 + 1/4(4)4 + e4] –[1/6 (0.5)6 + 1/5 (0.5)5 + 1/4(0.5)4 + e5] } = (1006.06) –(1.752865) = 1004.3071 function [q,ea,iter]=romberg(func,a,b,es,maxit,varargin) % if nargin<3,error('at least 3arguments required'),end if nargin<4||isempty(es),es=0.000001;end if nargin<5||isempty(maxit),maxit=50;end n=1; r(1,1) = trap(func,a,b,n,varargin{:}); iter=0; while iter<maxit iter=iter+1; n=2^iter; I(iter+1,1)=trap(func,a,b,n,varargin{:}); for k=2:iter+1 j=2+iter-k; I(j,k)=(4^(k-1)*I(j+1,k-1)-I(j,k-1))/(4^(k-1)-1); end ea=abs((I(1,iter+1)-I(2,iter))/I(1,iter+1))*100; if ea<=es, break; end end q=I(1,iter+1); function I=trap(func,a,b,n,varargin) if(nargin<3) error('at least 3 input arguments required');
  • 2. end if ~(b>a),error('upper bound must be greater than lower'),end if nargin<4||isempty(n),n=100;end x=a; h=(b-a)/n; s=func(a,varargin{:}); for i=1:n-1 x=x+h; s=s+2*func(x,varargin{:}); end s=s+func(b,varargin{:}); I=(b-a)*s/(2*n); >> f=@(x) x^5+x^4+x^3+exp(x); >> romberg(f,0.5,4) ans = 1.0044e+003
  • 3. Q2. Calculate the integral dt. The exact answer to this integral is 15.41260804810169. Solve the integral using the Romberg method Solution function [q,ea,iter]=romberg(func,a,b,es,maxit,varargin) % if nargin<3,error('at least 3arguments required'),end if nargin<4||isempty(es),es=0.000001;end if nargin<5||isempty(maxit),maxit=50;end n=1; r(1,1) = trap(func,a,b,n,varargin{:}); iter=0; while iter<maxit iter=iter+1; n=2^iter; I(iter+1,1)=trap(func,a,b,n,varargin{:}); for k=2:iter+1 j=2+iter-k; I(j,k)=(4^(k-1)*I(j+1,k-1)-I(j,k-1))/(4^(k-1)-1); end ea=abs((I(1,iter+1)-I(2,iter))/I(1,iter+1))*100; if ea<=es, break; end end q=I(1,iter+1); function I=trap(func,a,b,n,varargin) if(nargin<3) error('at least 3 input arguments required'); end if ~(b>a),error('upper bound must be greater than lower'),end if nargin<4||isempty(n),n=100;end x=a; h=(b-a)/n; s=func(a,varargin{:}); for i=1:n-1 x=x+h; s=s+2*func(x,varargin{:}); end s=s+func(b,varargin{:}); I=(b-a)*s/(2*n);
  • 4. >> f=@(t) (10*exp(-t)*sin(2*pi*t))^2 >> romberg (f,0,0.5) ans = 15.4126