Question

QUESTION 22 Consider the following Matlab code to produce a series <nzin2 n=1; Mo=-1; Mn=0; while Mn>MO Mo=Mn; Mn=Mn+n* (-2);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The logical evolution will become false when the terms in the series become so small that the sum does not change relative to the machine precision and the loop will terminates.

Mn=Mn+n^(-2)
n = n+1

Every time add  n-2 that is 1/n2 to the previous.

For large values of n the value of 1/n2 is equal to the 0 machine does not identify large precision.

So Mn > M0 condition fail.

Option B correct

Add a comment
Know the answer?
Add Answer to:
QUESTION 22 Consider the following Matlab code to produce a series <nzin2 n=1; Mo=-1; Mn=0; while...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Implement the following equation using matlab code N-1 1 Em N x(mN) i-0 N-1 1 Em N x(mN) i-0

    Implement the following equation using matlab code N-1 1 Em N x(mN) i-0 N-1 1 Em N x(mN) i-0

  • Question 1: 1. Figure out what the following MATLAB code does (Notice that R n =...

    Question 1: 1. Figure out what the following MATLAB code does (Notice that R n = 500 for jay - 1:4 ifjoy > 1;oldtime = time; end M rand(n); t cputime; forrep -1:5 R chol(A): en time = cputime-t; if jay > 1; ratio - time/oldtime, end en If you put these instructions into a file named, say, zap.m, you can run the program by typing zap from the MATLAB command line. The functions randn, cputime, and chol are built-in...

  • stion 1: Figure out what the following MATLAB code does (Notice that R = LT) n=500:...

    stion 1: Figure out what the following MATLAB code does (Notice that R = LT) n=500: for jay- 1:4 if jay > 1; oldtime-time; end M = rand(n) t = cputime; for rep 1: R chol(A); end time-cputime-t if jay > 1; ratio = time/oldtime, end enc If you put these instructions into a file named, say, zap.m, you can run the program by typing zap from the MATLAB command line. The functions randn, cputime, and chol are built-in MATLAB...

  • 1. [12 marks] In the following parts of this question, write a MATLAB code to solve a linear syst...

    1. [12 marks] In the following parts of this question, write a MATLAB code to solve a linear system A b (A is a square nonsingular matrix) using Jacobi and Gauss-Seidel algorithms. Do not use the built-in Matlab functions for solving linear systems (a) Write a Matlab function called Jacobi that consumes a square n x n matrix A, and an n x 1 vector b, and uses the Jacobi technique to solve the system Ax-b, starting with the zero...

  • Self-check exercise: While-loops The value of (π^2)/8 can be approximated by the series Write a script...

    Self-check exercise: While-loops The value of (π^2)/8 can be approximated by the series Write a script that evaluates this expression, ignoring all terms that are strictly smaller than .000001. Your script should display the number of terms summed and the sum. Use a while-loop. Think about the initialization of your variables and the order of computation carefully! In the loop body you need to calculate the value of a term only once. We use the above series for approximating (π^2)/8...

  • Question 1 Not yet answered Marked out of 1.00 Not flaggedFlag question Question text The statements...

    Question 1 Not yet answered Marked out of 1.00 Not flaggedFlag question Question text The statements inside of a Python loop are known as the ____ of the loop. Select one: a. body b. expression c. counter d. block Question 2 Not yet answered Marked out of 1.00 Not flaggedFlag question Question text The Python 3 program below prints the number 3. s = "Python3" print(s[len(s)]) Select one: True False Question 3 Not yet answered Marked out of 1.00 Not...

  • Notes for lab dc02-Resistors and the Color Code will skip are Part 2 e, g: Part 4; Exercises 2, 4,5,6 an...

    Notes for lab dc02-Resistors and the Color Code will skip are Part 2 e, g: Part 4; Exercises 2, 4,5,6 and 3. It is important to answer the exercises correctly in each labl you should include the appropriate prefix for the unit in the Numerical Value We will not be Volt using the Volt-Ohm meter (VOM) for this lab, so skip the parts that ask for VOM measurements. The parts we You do need to complete Exercises1 Note that in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT