Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help and explain While - Iterate until My Solutions Let's consider the following sequence 1 3 17 Which is defined by: x1 = 1.x

image text in transcribed

Please help and explain

image text in transcribed

image text in transcribed

While - Iterate until My Solutions Let's consider the following sequence 1 3 17 Which is defined by: x1 = 1.x = b + for k= 2.3.4....N -1 Let's break this down before we make use of the sequence. Everytime we increase k. we find a new But to do so, we calculate the new x based on the equation which also references the previous value of x. We call that previous value of x, X-1 This sequence converges on 2 as Nincreases which allows us to approximate the actual square root of 2. We can define the absolute error with this equation: e = 2 - xy Maybe it's been a while since you've seen these verticle bars in an equation. These denote the absolute value of what's inside A template has been provided below to start with some assumptions such as the naming of the variables you need to use Given the tolerance provided (maximum error tolerated) find the number of times the sequence needs to step through to get to this maximum error. As a hint, start your while loop first, with a test that will enter the loop and stay in the loop, until the error is smaller than our tolerance Make sure you add "end at the end of this loop too! Next. Write out the code to support calculating what the sequwnce term is for this k Script ES C Reset EN MATLAB Documentation 1 errorTol - le-15 % The tolerance used as the convergence criterion. This is set, and should not be changed. 2 %% 3 errorAbsolute = 100; % We are going to start with a predefined error, that we know will enter a while loop. 4 numTerms = 0; % We can initialize the number of terms to zero, and 5 lastTerm = 1; % intialize the first term to one. But after this, we need to calculate each term 6. While () % Fill in this blank, what will you use as a test condition? lastTerm = % this is the same as x_k, right? errorAbsolute = % update the absolute error % how can we track how many terms in we are? 10 11 % what comes at the end of a while loop? 7 13 % Finally, output the three variables we will be testing against, that's numTerms, lastTerm, and errorAbsolute. While - Iterate until My Solutions Let's consider the following sequence: 3 17 1 2.12. Which is defined by: I for k= 2,3,4....N Let's break this down before we make use of the sequence. Everytime we increase k, we find a new xx. But to do so, we calculate the new x based on the equation, which also references the previous value of x. We call that previous value of r, X2-1 This sequence converges on 2 as Nincreases, which allows us to approximate the actual square root of 2. We can define the absolute error with this equation: e=V2 - xxl Maybe it's been a while since you've seen these verticle bars in an equation. These denote the absolute value of what's inside. A template has been provided below to start with some assumptions, such as the naming of the variables you need to use. Given the tolerance provided (maximum error tolerated), find the number of times the sequence needs to step through to get to this maximum error. As a hint, start your while loop first, with a test that will enter the loop, and stay in the loop, until the error is smaller than our tolerance. Make sure you add "end" at the end of this loop too! Next, write out the code to support calculating what the sequwnce term is for this k. Script Save C Reset 1 errorTol = le-15 % The tolerance used as the convergence criterion. This is set, and should not be changed. 2 %% 3 errorAbsolute = 100; % We are going to start with a predefined error, that we know will enter a while loop. 4 numTerms = 0; % We can initialize the number of terms to zero, and 5 lastTerm = 1; % intialize the first term to one. But after this, we need to calculate each term 6 while ( ) % Fill in this blank, what will you use as a test condition? lastTerm = % this is the same as x_k, right? errorAbsolute = % update the absolute error % how can we track how many terms in we are? 7 8 9 10 11 % what comes at the end of a while loop? 12 13 % Finally, output the three variables we will be testing against, that's numTerms, lastTerm, and errorAbsolute

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

3. What information do participants need?

Answered: 1 week ago