SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...anilsa9823
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Roland Driesen
 
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneVIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
DEPED Work From Home WORKWEEK-PLAN.docx
DEPED Work From Home  WORKWEEK-PLAN.docxDEPED Work From Home  WORKWEEK-PLAN.docx
DEPED Work From Home WORKWEEK-PLAN.docxRodelinaLaud
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
 
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 VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Delhi Call girls
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurSuhani Kapoor
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsApsara Of India
 
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
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
 
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
 

Dernier (20)

Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
 
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)
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneVIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
DEPED Work From Home WORKWEEK-PLAN.docx
DEPED Work From Home  WORKWEEK-PLAN.docxDEPED Work From Home  WORKWEEK-PLAN.docx
DEPED Work From Home WORKWEEK-PLAN.docx
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
Best Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting PartnershipBest Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting Partnership
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
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 VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
Best VIP Call Girls Noida Sector 40 Call Me: 8448380779
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
 
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
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
 
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
 

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