SlideShare a Scribd company logo
This is testing Algorithm Writing
For this assessment we will be combining while and if control structures together.
(A):Write a pseudocode (pen and paper) algorithm that solves the ODE y'= f(t, y) using Euler’s
method.
(B):Convert this algorithm into MATLAB syntax, as the function euler method .
B1:Your inputs should be the start time t0, the end time tend, the function f, an initial condition
y0 and an initial step size h.
B2:If h × f(t, y) at any point exceeds 1, your function should halve the step size h.
B3:Equally, if h × f(t, y) at any point drops below 0.01, your function should double the step
size h.
B4:You should also make sure that the final solution step doesn’t ‘overshoot’ tend. (i.e. change
h during the final step to exactly reach tend).
B5:Your MATLAB code should use the function header below, and be wellcommented with a
sensible layout.
(C)Include your pseudocode algorithm, as well as the MATLAB code in your Portfolio
submission. Also include a discussion of when the code could break, or give incorrect outputs
(you DO NOT need to design your code to avoid these).
Solution
Answer:)
A)
The derivative term in the first order ivp:
y' = f(t, y),
y(t0) = y0
is approtimated by making use of Taylor series approtimation of the dependent variable y(t) at
the point ti+1. That is
y(ti+1) = y(ti+ Dt) = y(ti) + Dty'(ti) + (Dt2 / 2)y''(ti) + . . .
= y(ti) + Dtf(ti, yi) + (Dt2 / 2)y''(ti) + . . .
(... y'(ti) = f(ti, yi))
if the infinite series is truncated from the term Dt2 onwards, then
y(ti+1) = y(ti) + Dt y'(ti) (or)
yi+1 = yi + Dt fi for all i
That is,
for i = 0, y1 = y0 + Dt f0
i = 1, y2 = y1 + Dt f1
!
i = n-1, yn = yn-1 + Dt fn-1
Since y0 and hence f0 are known (from initial condition) in the equation corresponding to i = 0,
all the terms on the r.h.s are known. So y1 that is, y at t1 is calculated easily from this equation.
Similarly once y1 is known, r.h.s of the equation corresponding to i = 1 is also known so y2 can
be computed. As we proceed in the same way until i = n-1, yn can be obtained. This is an etplicit
method because in any equation there is only one unknown which can be separated to the left
side of the equation.
Local truncation error :
The error in the approtimation, that is the difference between the exact solution at ti+1 and the
numerical solution yi+1 is called the local truncation error (assumed that yi+1 is calculated with
exact arithmetic with out any round off error).
Ti+1 = y(ti+1) - yi+1
= y(ti+1) - yi - Dtfi
= h2/2 y'(t) (by Taylor series & remainder theorem)
where ti < t < ti+1. Hence the order of the local truncation error for Euler scheme is
O(Dt2) as Dt -> 0

More Related Content

Similar to This is testing Algorithm Writing For this assessment we will be c.pdf

SURF 2012 Final Report(1)
SURF 2012 Final Report(1)SURF 2012 Final Report(1)
SURF 2012 Final Report(1)Eric Zhang
 
Matlab lab.pdf
Matlab lab.pdfMatlab lab.pdf
Matlab lab.pdf
stirlingvwriters
 
Euler Method
Euler MethodEuler Method
Euler Method
Saloni Singhal
 
Intro laplacetransform
Intro laplacetransformIntro laplacetransform
Intro laplacetransform
Tushar Dey
 
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docxMATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
andreecapon
 
Algorithm Exam Help
Algorithm Exam HelpAlgorithm Exam Help
Algorithm Exam Help
Programming Exam Help
 
Conjugate Gradient Methods
Conjugate Gradient MethodsConjugate Gradient Methods
Conjugate Gradient Methods
MTiti1
 
Fourier series 1
Fourier series 1Fourier series 1
Fourier series 1
Faiza Saher
 
This problem illustrates one of the possible pitfalls of blindly appl.pdf
This problem illustrates one of the possible pitfalls of blindly appl.pdfThis problem illustrates one of the possible pitfalls of blindly appl.pdf
This problem illustrates one of the possible pitfalls of blindly appl.pdf
arihantmum
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
Programming Homework Help
 
01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf
BRNSS Publication Hub
 
Trapezoidal Method IN Numerical Analysis
Trapezoidal Method IN  Numerical AnalysisTrapezoidal Method IN  Numerical Analysis
Trapezoidal Method IN Numerical Analysis
Mostafijur Rahman
 
On Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach SpaceOn Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach Space
BRNSS Publication Hub
 
Signal Processing Introduction using Fourier Transforms
Signal Processing Introduction using Fourier TransformsSignal Processing Introduction using Fourier Transforms
Signal Processing Introduction using Fourier TransformsArvind Devaraj
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATION
Dhrupal Patel
 

Similar to This is testing Algorithm Writing For this assessment we will be c.pdf (20)

SURF 2012 Final Report(1)
SURF 2012 Final Report(1)SURF 2012 Final Report(1)
SURF 2012 Final Report(1)
 
Matlab lab.pdf
Matlab lab.pdfMatlab lab.pdf
Matlab lab.pdf
 
Euler Method
Euler MethodEuler Method
Euler Method
 
Intro laplacetransform
Intro laplacetransformIntro laplacetransform
Intro laplacetransform
 
Integrating_Factors
Integrating_FactorsIntegrating_Factors
Integrating_Factors
 
D021018022
D021018022D021018022
D021018022
 
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docxMATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
 
Algorithm Exam Help
Algorithm Exam HelpAlgorithm Exam Help
Algorithm Exam Help
 
Conjugate Gradient Methods
Conjugate Gradient MethodsConjugate Gradient Methods
Conjugate Gradient Methods
 
Fourier series 1
Fourier series 1Fourier series 1
Fourier series 1
 
This problem illustrates one of the possible pitfalls of blindly appl.pdf
This problem illustrates one of the possible pitfalls of blindly appl.pdfThis problem illustrates one of the possible pitfalls of blindly appl.pdf
This problem illustrates one of the possible pitfalls of blindly appl.pdf
 
Fourier Analysis
Fourier AnalysisFourier Analysis
Fourier Analysis
 
Fourier Analysis
Fourier AnalysisFourier Analysis
Fourier Analysis
 
Fourier series
Fourier seriesFourier series
Fourier series
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf01_AJMS_277_20_20210128_V1.pdf
01_AJMS_277_20_20210128_V1.pdf
 
Trapezoidal Method IN Numerical Analysis
Trapezoidal Method IN  Numerical AnalysisTrapezoidal Method IN  Numerical Analysis
Trapezoidal Method IN Numerical Analysis
 
On Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach SpaceOn Generalized Classical Fréchet Derivatives in the Real Banach Space
On Generalized Classical Fréchet Derivatives in the Real Banach Space
 
Signal Processing Introduction using Fourier Transforms
Signal Processing Introduction using Fourier TransformsSignal Processing Introduction using Fourier Transforms
Signal Processing Introduction using Fourier Transforms
 
APPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATIONAPPLICATION OF PARTIAL DIFFERENTIATION
APPLICATION OF PARTIAL DIFFERENTIATION
 

More from aroraopticals15

For a given H0 and level of significance, if you reject the H0 for a.pdf
For a given H0 and level of significance, if you reject the H0 for a.pdfFor a given H0 and level of significance, if you reject the H0 for a.pdf
For a given H0 and level of significance, if you reject the H0 for a.pdf
aroraopticals15
 
Find all elements of our ring R that have norm 1. Show that no elemen.pdf
Find all elements of our ring R that have norm 1. Show that no elemen.pdfFind all elements of our ring R that have norm 1. Show that no elemen.pdf
Find all elements of our ring R that have norm 1. Show that no elemen.pdf
aroraopticals15
 
Evaluate the decision to have a computer usage policy and the potent.pdf
Evaluate the decision to have a computer usage policy and the potent.pdfEvaluate the decision to have a computer usage policy and the potent.pdf
Evaluate the decision to have a computer usage policy and the potent.pdf
aroraopticals15
 
(java) eclipse PleaseDevelop an application that implements a pro.pdf
(java) eclipse PleaseDevelop an application that implements a pro.pdf(java) eclipse PleaseDevelop an application that implements a pro.pdf
(java) eclipse PleaseDevelop an application that implements a pro.pdf
aroraopticals15
 
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdfAt a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
aroraopticals15
 
Above is a trace depicting mechanical activity of frog heart. A stud.pdf
Above is a trace depicting mechanical activity of frog heart. A stud.pdfAbove is a trace depicting mechanical activity of frog heart. A stud.pdf
Above is a trace depicting mechanical activity of frog heart. A stud.pdf
aroraopticals15
 
A gymnosperm, such as Juniperus virginiana, that produces female con.pdf
A gymnosperm, such as Juniperus virginiana, that produces female con.pdfA gymnosperm, such as Juniperus virginiana, that produces female con.pdf
A gymnosperm, such as Juniperus virginiana, that produces female con.pdf
aroraopticals15
 
Write short descriptive answer to the following questions Discuss wh.pdf
Write short descriptive answer to the following questions  Discuss wh.pdfWrite short descriptive answer to the following questions  Discuss wh.pdf
Write short descriptive answer to the following questions Discuss wh.pdf
aroraopticals15
 
Why should anyone else care about what I do with my sewage on my own .pdf
Why should anyone else care about what I do with my sewage on my own .pdfWhy should anyone else care about what I do with my sewage on my own .pdf
Why should anyone else care about what I do with my sewage on my own .pdf
aroraopticals15
 
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdfWhy do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
aroraopticals15
 
Which of the following used historicalcomparative methods in their .pdf
Which of the following used historicalcomparative methods in their .pdfWhich of the following used historicalcomparative methods in their .pdf
Which of the following used historicalcomparative methods in their .pdf
aroraopticals15
 
Which of following is not a class of the phylum platyhelminthes Tre.pdf
Which of following is not a class of the phylum platyhelminthes  Tre.pdfWhich of following is not a class of the phylum platyhelminthes  Tre.pdf
Which of following is not a class of the phylum platyhelminthes Tre.pdf
aroraopticals15
 
What is wrong with this code Please fix.code#include stdio.h.pdf
What is wrong with this code Please fix.code#include stdio.h.pdfWhat is wrong with this code Please fix.code#include stdio.h.pdf
What is wrong with this code Please fix.code#include stdio.h.pdf
aroraopticals15
 
What are two ways that meiosis could produce gametes that contai.pdf
What are two ways that meiosis could produce gametes that contai.pdfWhat are two ways that meiosis could produce gametes that contai.pdf
What are two ways that meiosis could produce gametes that contai.pdf
aroraopticals15
 
what is the process in society that made this change to advertising .pdf
what is the process in society that made this change to advertising .pdfwhat is the process in society that made this change to advertising .pdf
what is the process in society that made this change to advertising .pdf
aroraopticals15
 
What is the best way to go about designing an Android AppSoluti.pdf
What is the best way to go about designing an Android AppSoluti.pdfWhat is the best way to go about designing an Android AppSoluti.pdf
What is the best way to go about designing an Android AppSoluti.pdf
aroraopticals15
 
Use the following word bank to complete the numbers 51-100. Acoeloma.pdf
Use the following word bank to complete the numbers 51-100.  Acoeloma.pdfUse the following word bank to complete the numbers 51-100.  Acoeloma.pdf
Use the following word bank to complete the numbers 51-100. Acoeloma.pdf
aroraopticals15
 
Two cards are randomly selected from a 52-card deck. What is the pro.pdf
Two cards are randomly selected from a 52-card deck. What is the pro.pdfTwo cards are randomly selected from a 52-card deck. What is the pro.pdf
Two cards are randomly selected from a 52-card deck. What is the pro.pdf
aroraopticals15
 
Two labs are being compared to determine if they are providing the sa.pdf
Two labs are being compared to determine if they are providing the sa.pdfTwo labs are being compared to determine if they are providing the sa.pdf
Two labs are being compared to determine if they are providing the sa.pdf
aroraopticals15
 
Todopackage hwk6; This class contains the configuration of a t.pdf
Todopackage hwk6; This class contains the configuration of a t.pdfTodopackage hwk6; This class contains the configuration of a t.pdf
Todopackage hwk6; This class contains the configuration of a t.pdf
aroraopticals15
 

More from aroraopticals15 (20)

For a given H0 and level of significance, if you reject the H0 for a.pdf
For a given H0 and level of significance, if you reject the H0 for a.pdfFor a given H0 and level of significance, if you reject the H0 for a.pdf
For a given H0 and level of significance, if you reject the H0 for a.pdf
 
Find all elements of our ring R that have norm 1. Show that no elemen.pdf
Find all elements of our ring R that have norm 1. Show that no elemen.pdfFind all elements of our ring R that have norm 1. Show that no elemen.pdf
Find all elements of our ring R that have norm 1. Show that no elemen.pdf
 
Evaluate the decision to have a computer usage policy and the potent.pdf
Evaluate the decision to have a computer usage policy and the potent.pdfEvaluate the decision to have a computer usage policy and the potent.pdf
Evaluate the decision to have a computer usage policy and the potent.pdf
 
(java) eclipse PleaseDevelop an application that implements a pro.pdf
(java) eclipse PleaseDevelop an application that implements a pro.pdf(java) eclipse PleaseDevelop an application that implements a pro.pdf
(java) eclipse PleaseDevelop an application that implements a pro.pdf
 
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdfAt a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
At a sudden contraction in a pipe the diameter changes from D_1 to D_.pdf
 
Above is a trace depicting mechanical activity of frog heart. A stud.pdf
Above is a trace depicting mechanical activity of frog heart. A stud.pdfAbove is a trace depicting mechanical activity of frog heart. A stud.pdf
Above is a trace depicting mechanical activity of frog heart. A stud.pdf
 
A gymnosperm, such as Juniperus virginiana, that produces female con.pdf
A gymnosperm, such as Juniperus virginiana, that produces female con.pdfA gymnosperm, such as Juniperus virginiana, that produces female con.pdf
A gymnosperm, such as Juniperus virginiana, that produces female con.pdf
 
Write short descriptive answer to the following questions Discuss wh.pdf
Write short descriptive answer to the following questions  Discuss wh.pdfWrite short descriptive answer to the following questions  Discuss wh.pdf
Write short descriptive answer to the following questions Discuss wh.pdf
 
Why should anyone else care about what I do with my sewage on my own .pdf
Why should anyone else care about what I do with my sewage on my own .pdfWhy should anyone else care about what I do with my sewage on my own .pdf
Why should anyone else care about what I do with my sewage on my own .pdf
 
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdfWhy do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
Why do viral particles, zymosan on fungi, endotoxin (LPS) from gram .pdf
 
Which of the following used historicalcomparative methods in their .pdf
Which of the following used historicalcomparative methods in their .pdfWhich of the following used historicalcomparative methods in their .pdf
Which of the following used historicalcomparative methods in their .pdf
 
Which of following is not a class of the phylum platyhelminthes Tre.pdf
Which of following is not a class of the phylum platyhelminthes  Tre.pdfWhich of following is not a class of the phylum platyhelminthes  Tre.pdf
Which of following is not a class of the phylum platyhelminthes Tre.pdf
 
What is wrong with this code Please fix.code#include stdio.h.pdf
What is wrong with this code Please fix.code#include stdio.h.pdfWhat is wrong with this code Please fix.code#include stdio.h.pdf
What is wrong with this code Please fix.code#include stdio.h.pdf
 
What are two ways that meiosis could produce gametes that contai.pdf
What are two ways that meiosis could produce gametes that contai.pdfWhat are two ways that meiosis could produce gametes that contai.pdf
What are two ways that meiosis could produce gametes that contai.pdf
 
what is the process in society that made this change to advertising .pdf
what is the process in society that made this change to advertising .pdfwhat is the process in society that made this change to advertising .pdf
what is the process in society that made this change to advertising .pdf
 
What is the best way to go about designing an Android AppSoluti.pdf
What is the best way to go about designing an Android AppSoluti.pdfWhat is the best way to go about designing an Android AppSoluti.pdf
What is the best way to go about designing an Android AppSoluti.pdf
 
Use the following word bank to complete the numbers 51-100. Acoeloma.pdf
Use the following word bank to complete the numbers 51-100.  Acoeloma.pdfUse the following word bank to complete the numbers 51-100.  Acoeloma.pdf
Use the following word bank to complete the numbers 51-100. Acoeloma.pdf
 
Two cards are randomly selected from a 52-card deck. What is the pro.pdf
Two cards are randomly selected from a 52-card deck. What is the pro.pdfTwo cards are randomly selected from a 52-card deck. What is the pro.pdf
Two cards are randomly selected from a 52-card deck. What is the pro.pdf
 
Two labs are being compared to determine if they are providing the sa.pdf
Two labs are being compared to determine if they are providing the sa.pdfTwo labs are being compared to determine if they are providing the sa.pdf
Two labs are being compared to determine if they are providing the sa.pdf
 
Todopackage hwk6; This class contains the configuration of a t.pdf
Todopackage hwk6; This class contains the configuration of a t.pdfTodopackage hwk6; This class contains the configuration of a t.pdf
Todopackage hwk6; This class contains the configuration of a t.pdf
 

Recently uploaded

Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 

Recently uploaded (20)

Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 

This is testing Algorithm Writing For this assessment we will be c.pdf

  • 1. This is testing Algorithm Writing For this assessment we will be combining while and if control structures together. (A):Write a pseudocode (pen and paper) algorithm that solves the ODE y'= f(t, y) using Euler’s method. (B):Convert this algorithm into MATLAB syntax, as the function euler method . B1:Your inputs should be the start time t0, the end time tend, the function f, an initial condition y0 and an initial step size h. B2:If h × f(t, y) at any point exceeds 1, your function should halve the step size h. B3:Equally, if h × f(t, y) at any point drops below 0.01, your function should double the step size h. B4:You should also make sure that the final solution step doesn’t ‘overshoot’ tend. (i.e. change h during the final step to exactly reach tend). B5:Your MATLAB code should use the function header below, and be wellcommented with a sensible layout. (C)Include your pseudocode algorithm, as well as the MATLAB code in your Portfolio submission. Also include a discussion of when the code could break, or give incorrect outputs (you DO NOT need to design your code to avoid these). Solution Answer:) A) The derivative term in the first order ivp: y' = f(t, y), y(t0) = y0 is approtimated by making use of Taylor series approtimation of the dependent variable y(t) at the point ti+1. That is y(ti+1) = y(ti+ Dt) = y(ti) + Dty'(ti) + (Dt2 / 2)y''(ti) + . . . = y(ti) + Dtf(ti, yi) + (Dt2 / 2)y''(ti) + . . . (... y'(ti) = f(ti, yi)) if the infinite series is truncated from the term Dt2 onwards, then y(ti+1) = y(ti) + Dt y'(ti) (or) yi+1 = yi + Dt fi for all i That is, for i = 0, y1 = y0 + Dt f0
  • 2. i = 1, y2 = y1 + Dt f1 ! i = n-1, yn = yn-1 + Dt fn-1 Since y0 and hence f0 are known (from initial condition) in the equation corresponding to i = 0, all the terms on the r.h.s are known. So y1 that is, y at t1 is calculated easily from this equation. Similarly once y1 is known, r.h.s of the equation corresponding to i = 1 is also known so y2 can be computed. As we proceed in the same way until i = n-1, yn can be obtained. This is an etplicit method because in any equation there is only one unknown which can be separated to the left side of the equation. Local truncation error : The error in the approtimation, that is the difference between the exact solution at ti+1 and the numerical solution yi+1 is called the local truncation error (assumed that yi+1 is calculated with exact arithmetic with out any round off error). Ti+1 = y(ti+1) - yi+1 = y(ti+1) - yi - Dtfi = h2/2 y'(t) (by Taylor series & remainder theorem) where ti < t < ti+1. Hence the order of the local truncation error for Euler scheme is O(Dt2) as Dt -> 0