Numerical analysis, floating-point arithmetic

In summary, the conversation discusses a numerical analysis problem about the representation of floating point numbers and their difference in a base B system. It is shown that the claim is true for B = 2 but a counterexample is needed for B > 2. The attempt at a solution explores the binary case and concludes that the difference is exactly representable. However, for higher bases, specific numbers must be used to find a counterexample.
  • #1
Chasing_Time
8
0
Hi all, this (probably easy) problem from numerical analysis is giving me trouble. I can't seem to get started and need some poking in the right direction.

Homework Statement



Consider the following claim: if two floating point numbers x and y with the same sign differ by a factor of at most the base B (1/B <= x/y <= B), then their difference x-y is exactly representable in the floating point system. Show that this claim is true for B = 2 but give a counter example for B > 2.


Homework Equations



The general form of a floating point number:

[tex] x = d_0.d_1 ... d_{t-1} * 10^e [/tex]


The Attempt at a Solution



I have tried exploring the binary case, noting that d_0 must be = 1 in base B=2:

[tex] x = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^e [/tex]
[tex] y = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^{e-1} = (\frac {1}{2} + \frac {d_1} {4} + ... + \frac {d_{t-1}} {2^t}) * 2^e[/tex]
[tex] x - y = (1 + \frac {d_1 - 1} {2} + ... + \frac {d_{t-1} - d_{t-2}} {2^{t-1}} - \frac {d_{t-1}} {2^t})*2^e[/tex]

Is this "exactly representable" in the floating-point system? I don't know what else to do or what to use as a counter example. Am I even on the right track? Thanks for any help.
 
Physics news on Phys.org
  • #2
Chasing_Time said:
Hi all, this (probably easy) problem from numerical analysis is giving me trouble. I can't seem to get started and need some poking in the right direction.

Homework Statement



Consider the following claim: if two floating point numbers x and y with the same sign differ by a factor of at most the base B (1/B <= x/y <= B), then their difference x-y is exactly representable in the floating point system. Show that this claim is true for B = 2 but give a counter example for B > 2.


Homework Equations



The general form of a floating point number:

[tex] x = d_0.d_1 ... d_{t-1} * 10^e [/tex]


The Attempt at a Solution



I have tried exploring the binary case, noting that d_0 must be = 1 in base B=2:

[tex] x = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^e [/tex]
[tex] y = (1 + \frac {d_1}{2} + ... + \frac {d_{t-1}} {2^{t-1}}) * 2^{e-1} = (\frac {1}{2} + \frac {d_1} {4} + ... + \frac {d_{t-1}} {2^t}) * 2^e[/tex]
[tex] x - y = (1 + \frac {d_1 - 1} {2} + ... + \frac {d_{t-1} - d_{t-2}} {2^{t-1}} - \frac {d_{t-1}} {2^t})*2^e[/tex]
Your arithmetic is off here. Since you have set this up with x being two times y, the difference x - y better be equal to y.
Chasing_Time said:
Is this "exactly representable" in the floating-point system? I don't know what else to do or what to use as a counter example. Am I even on the right track? Thanks for any help.
Certainly x - y is exactly representable in a base-2 floating-point system, as long as x and y are.

I don't have any examples in mind that would serve as counterexamples, but if you work with some specific numbers in base 3 or higher bases, you might be able to come up with one. By "specific numbers" I mean that you should work with numbers like 2.0121 X 32 (base-3), rather than symbolically representing the digits with d1, d2, etc. That's where I would start.
 

Related to Numerical analysis, floating-point arithmetic

1. What is numerical analysis?

Numerical analysis is a branch of mathematics that focuses on developing algorithms and methods for solving mathematical problems using numerical approximations. It involves the use of computers to perform calculations and obtain solutions that would be difficult or impossible to achieve by hand.

2. What is floating-point arithmetic?

Floating-point arithmetic is a method of representing and performing calculations with real numbers on a computer. It involves breaking down a number into a sign, a significand, and an exponent, and then using these components to perform arithmetic operations. This method allows for a wider range of numbers to be represented compared to fixed-point arithmetic.

3. Why is numerical analysis important?

Numerical analysis plays a crucial role in many scientific and engineering fields, including physics, engineering, and computer science. It allows for the solution of complex mathematical problems that would be otherwise impossible to solve, and it also helps to improve the accuracy and efficiency of calculations.

4. What are some common applications of numerical analysis?

Numerical analysis has a wide range of applications, including solving differential equations, optimizing functions, simulating physical systems, and performing data analysis. It is also used in fields such as finance, weather forecasting, and image processing.

5. What are the limitations of floating-point arithmetic?

While floating-point arithmetic is a powerful tool, it has some limitations that can affect the accuracy of calculations. These include rounding errors, underflow and overflow, and the inability to represent certain numbers precisely. It is important for scientists and engineers to be aware of these limitations and use appropriate methods to minimize their impact.

Similar threads

  • Computing and Technology
Replies
4
Views
816
Replies
4
Views
983
  • Calculus and Beyond Homework Help
Replies
7
Views
343
  • Calculus and Beyond Homework Help
Replies
1
Views
727
  • Calculus and Beyond Homework Help
Replies
8
Views
290
  • Calculus and Beyond Homework Help
Replies
3
Views
588
  • Calculus and Beyond Homework Help
Replies
5
Views
334
  • Calculus and Beyond Homework Help
Replies
3
Views
592
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
282
Back
Top