squiggle/packages/website/docs/Discussions/Bugs.mdx

41 lines
1.8 KiB
Plaintext
Raw Normal View History

2022-04-21 19:44:00 +00:00
---
title: "Known Bugs"
sidebar_position: 1
2022-04-21 19:44:00 +00:00
---
import { SquiggleEditor } from "../../src/components/SquiggleEditor";
Much of the Squiggle math is imprecise. This can cause significant errors, so watch out.
2022-07-28 23:59:52 +00:00
Below are a few specific examples to watch for. We'll work on improving these over time and adding much better warnings and error management.
## Operations on very small or large numbers, silently round to 0 and 1
Squiggle is poor at dealing with very small or large numbers, given fundamental limitations of floating point precision.
See [this Github Issue](https://github.com/quantified-uncertainty/squiggle/issues/834).
2022-04-21 19:44:00 +00:00
## Mixtures of distributions with very different means
2022-04-21 19:54:28 +00:00
If you take the pointwise mixture of two distributions with very different means, then the value of that gets fairly warped.
2022-04-21 19:44:00 +00:00
In the following case, the mean of the mixture should be equal to the sum of the means of the parts. These are shown as the first two displayed variables. These variables diverge as the underlying distributions change.
<SquiggleEditor
defaultCode={`dist1 = {value: normal(1,1), weight: 1}
2022-04-21 19:44:00 +00:00
dist2 = {value: normal(100000000000,1), weight: 1}
totalWeight = dist1.weight + dist2.weight
distMixture = mixture(dist1.value, dist2.value, [dist1.weight, dist2.weight])
mixtureMean = mean(distMixture)
separateMeansCombined = (mean(dist1.value) * (dist1.weight) + mean(dist2.value) * (dist2.weight))/totalWeight
[mixtureMean, separateMeansCombined, distMixture]`}
/>
## Means of Sample Set Distributions
The means of sample set distributions can vary dramatically, especially as the numbers get high.
<SquiggleEditor
defaultCode={`symbolicDist = 5 to 50333333
sampleSetDist = SampleSet.fromDist(symbolicDist)
2022-04-21 19:54:28 +00:00
[mean(symbolicDist), mean(sampleSetDist), symbolicDist, sampleSetDist]`}
2022-07-28 23:59:52 +00:00
/>