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) Identify an equation that describes some chemical process.  Your equation should have at least two parameters, at least one of which should contribute in a non-linear way. He

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

This assignment deals with the combination of dynamic memory allocation and structures to create a common data structure known as a doubly-linked list, which is shown in Figure 1.

clear tic L=1; T=0.2; nust=2000; dt=T/nust; n=40; dx=L/n;   r=1;  omega=10:10:5000;%Store Range of Frequencies for Simulation u=zeros(n+1,nust+1);%

khdjkafhoi woiruwoi epojrpeo

Illustration of Function functions: For illustration, to pass the sin function into fplot, one would pass its handle as shown in figure for the result.   >> fplot(@s



Write a Matlab function that computes y1= tan(x) and y2= sin(x)/cos(x), returns the difference |y1–y2| and prints a message whether the two are equal or not. Test your function for

1;write a matlab of geuss elimination with scaling and pivoting under consideration?