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

what equation equals 36

For a statistically stationary environment it would be advantageous to use gear shifting, that is to reduce the adaptation gain with time. To illustrate this, try using a varying a

How to make EMG analysis by Matlab?

write a computer program that will provide a user with the equilibrium concentration of vacancies in a metallic element as a function of temperature.Temperature range should be men

i need matlab code on 2 dimensional analysis of temperature distribution in steel using finite element method

Format command: The format command can be used to control the spacing between the MATLAB command or expression and the outcome; it can be either compact or loose. >> format

The Format Function and ellipsis: The default in MATLAB is to show numbers which have decimal places with four decimal places. The format command can be used to identify the o

Show the output - algorithms: Where does the output go? The two possibilities are (i) to an external file, or (ii) to a window on the screen. Based on system, one of these wil

I need this task to be done with discription of matlab coding.