Decimals give different integrals than fractions; why?

  • Context: Mathematica 
  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Fractions Integrals
Click For Summary

Discussion Overview

The discussion centers around the differences in integral results when using decimal versus fractional representations in computational software, specifically Mathematica. Participants explore the implications of floating-point arithmetic and numerical versus symbolic computation.

Discussion Character

  • Technical explanation, Debate/contested, Exploratory

Main Points Raised

  • Some participants suggest that discrepancies in integral results may be due to roundoff errors associated with floating-point representation.
  • One participant emphasizes the importance of providing specific code examples to illustrate the issue more clearly.
  • Another participant points out that Mathematica treats approximate and exact numbers differently, leading to different evaluation methods (numerical vs. analytical).
  • Concerns are raised about how certain numbers cannot be accurately represented in floating-point format, potentially affecting calculations.
  • A participant mentions observing significant differences in plot maxima between different representations, indicating a potential issue with numerical computation.
  • Reference is made to a widely cited article on floating-point arithmetic, suggesting that understanding this topic is crucial for using computational software effectively.

Areas of Agreement / Disagreement

Participants express differing views on the nature of the problem, with some focusing on the role of floating-point representation and others on the specifics of Mathematica's computational methods. No consensus is reached regarding the exact cause of the discrepancies.

Contextual Notes

Limitations in understanding how Mathematica handles numerical versus symbolic computations are noted, as well as the potential for computational errors due to floating-point representation.

member 428835
Just like the title says. Is this due to roundoff?
 
Physics news on Phys.org
You really cannot expect us to be able to help you unless you give a specific example of code.
 
The code is kind of long. Are you sure you want me to give it? There's not a computational difference that you're aware of for exact numbers vs decimals?
 
Can't you illustrate it with a simpler example?

Its well known in computerdom that some numbers can't be represented properly in floating pt format so if Mathematica does a numerical computation with them them then computational error will creep into the calculation.

As an example, if you had some expression like ##3.0*sin(x)*(1.0/3.0)## and Mathematica symbolically reduces it to sin(x) then that result might be different from ##(3.0*sin(x)) / 3.0## where Mathematica didn't see the ONES identity and did the numerical computations of 3.0 * sin(x) then dividing by 3.0.

For larger numbers the result difference might be more pronounced as floating pt numbers kep to a certain limited digit precision.

 
jedishrfu said:
Can't you illustrate it with a simpler example?

Its well known in computerdom that some numbers can't be represented properly in floating pt format so if Mathematica does a numerical computation with them them then computational error will creep into the calculation.

As an example, if you had some expression like ##3.0*sin(x)*(1.0/3.0)## and Mathematica symbolically reduces it to sin(x) then that result might be different from ##(3.0*sin(x)) / 3.0## where Mathematica didn't see the ONES identity and did the numerical computations of 3.0 * sin(x) then dividing by 3.0.

For larger numbers the result difference might be more pronounced as floating pt numbers kep to a certain limited digit precision.


I'm not sure how to illustrate it with a simpler example, which shows how little I know about the issue. I can say when I plot a function (takes a lot of code to construct) one plot has max of 50 and the other has max 6000. Do you want me to post the code or pictures so you can see?
 
Mathematica does treat approximate and exact numbers differently. Usually approximate numbers make Mathematica evaluate it numerically using NIntegrate. In contrast an integrand with exact numbers will be solved analytically and then the limits of integration will be substituted at the end.
 
If you are going to rely on programming/software then you should really consider reading this article, it has been cited a huge number of times because of its importance:
What Every Computer Scientist Should Know About Floating-Point Arithmetic
https://www.itu.dk/~sestoft/bachelor/IEEE754_article.pdf

I think that Dale is trying to tell you something about your understanding of what Mathematica does behind the scenes. Consider it seriously.
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K