Closed
Description
The percent error can be displayed in two different ways:
- Way 1: Having a positive or negative percent error depending on the estimate we have.
- Way 2: Always having a positive value by just taking the absolute.
The two ways would be calculated like the following:
- Way 1: percent error =
[experimental value - theoretical value] / theoretical value x 100%
- Way 2: percent error =
(AbsoluteOf([experimental value - theoretical value])) / theoretical value x 100%
We now have the following state for the Monte Carlo implementations of the AAA:
- Some implementations are using Way 2 of the percent error and just provide an always positive number. The following languages are using way 2: Clojure, D, Go, Haskell, Python, R
- And some other languages are using Way 1, but making a mistake by doing so, they aer using the following calculation:
[theoretical value - experimental value] / theoretical value x 100%
instead of[experimental value - theoretical value] / theoretical value x 100%
The following languages are using way 1 incorrectly: C, Java, JavaScript, Julia, Rust, Swift
So the question is now: Should we use way 1 or way 2 in the AAA?
I vote for way 1 because it provides some nice additional information, i.e.:
Having a theoretical value
of 3 would result in a negative percentage and having a theoretical value
of 3.5 would result in a positive percentage. With way 2 it would be a positive percentage in both cases.
Progress Tracker - Way 2
Since we decided for way 2, the following to do list, shows which implementations need to be updated:
- Julia // Done: Small improvements and absolute percent error for the Julia Monte Carlo #325
- Swift // Done: Updating Monte Carlo in Swift #328
- Java // Done: Updating Monte Carlo in Java #371
- JavaScript // Done: Updating Error Calculation for Monte Carlo in Javascript #372
- C // Done: Fixing percentage error in monte_carlo.c #374
- Rust // Fixing percent error in monte_carlo.rs #381