Exact arithmetic, MATLAB Programming

Run the MATLAB script
sum = single(0); term = single(1);
n=1;
while sum + term > sum
sum = sum+term;
n=n+1;
term = 1/n;
end
n

Explain what you think it is trying to do. What would this code do in exact arithmetic?Describe why the code produces a nite result and (harder) describe the output. What would happen (don't try it!) if you replaced the fi rst line with sum=0; term=1;?

Posted Date: 3/22/2013 7:03:16 AM | Location : United States







Related Discussions:- Exact arithmetic, Assignment Help, Ask Question on Exact arithmetic, Get Answer, Expert's Help, Exact arithmetic Discussions

Write discussion on Exact arithmetic
Your posts are moderated
Related Questions
1. Assume that there exists a surface that can be modeled with the equation:  z = e-(x 2 + y 2 ).  a) Calculate ∇z at the point (x = 0, y = 0). b) In addition, use MATLAB to

Ask question #Mingdfgdfgdfgimum 100 words accepted#

Find the boundary between each two of the equations P1, P2, P3 by solving: P1 = P2  ,  P1 = P3  ,  P2 = P3 Plot the boundary lines on a single figure that also includes the

The diagram shown on the next page represents a planar pantograph-based leg for a walking robot. This model utilizes only one DOF to generate the walking gait at the foot link 'n

Write a script to determine the volume of a pyramid, which is 1/3 * base * height, where the base is length * width. On time the user to enter values for the length, width, and th

1;write the matlab of LU decomposion that can do any n*n matrix by considering scaling and pivoting?

People arrive at a microscope exhibit at a rate of one every 8+/- 2 minutes. Only one person can see the exhibit at a time. It takes 5 +/- 2 minutes to see the exhibit. A person

How do I compute and plot a temperature profile along the x axis from -6 to 6 given the equation for steady state heat conduction and boundary conditions


256789;267825;625892;982895;598289