diff --git a/AUTHORS b/AUTHORS index 01d47360fc..9e2e3de3a0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -287,16 +287,16 @@ Dheemanth D <165369664+Dheemanth07@users.noreply.github.com> Adriano Fantini Chibuike Anselm Jos de Jong -JSap0914 rrbharath Lê Vạn Bảo Trọng <32262183+chuanghiduoc@users.noreply.github.com> +Yash Goyal Hugohong258 Spoko Dev -Yash Goyal <24110399@iitgn.ac.in> Wei-Lun Li wulimammoth kevin <5299031+kevin9327@users.noreply.github.com> WenJing95 <126436871+WenJing95@users.noreply.github.com> W <184799977+waw666waw666@users.noreply.github.com> +JSap0914 # Generated by tools/update-authors.js diff --git a/HISTORY.md b/HISTORY.md index 1eaedca425..a586546671 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,9 @@ # unpublished changes since 15.2.0 +- Docs: update values of physical constants in units doc page, and + institute a check that they match the values in the math instance (#3740). + Thanks @YashG1836. - Feat: support bigint in stirlingS2(n,k) and ensure that result is always of correct type (#3663). Thanks @JSap0914 and @gwhitney. - Docs: #3401 add pages for String and Boolean types, clarify that concat diff --git a/docs/datatypes/units.md b/docs/datatypes/units.md index 96b27d46b4..5530007bc4 100644 --- a/docs/datatypes/units.md +++ b/docs/datatypes/units.md @@ -414,26 +414,26 @@ Math.js includes the following physical constants. See [Wikipedia](https://en.wi Name | Symbol | Value | Unit ----------------------|--------------------------------------------------------|-------------------|------------------------------------------------------- speedOfLight | c | 299792458 | m · s-1 -gravitationConstant | G | 6.6738480e-11 | m3 · kg-1 · s-2 -planckConstant | h | 6.626069311e-34 | J · s -reducedPlanckConstant | h | 1.05457172647e-34 | J · s +gravitationConstant | G | 6.67430e-11 | m3 · kg-1 · s-2 +planckConstant | h | 6.62607015e-34 | J · s +reducedPlanckConstant | h | 1.0545718176461565e-34 | J · s #### Electromagnetic constants Name | Symbol | Value | Unit --------------------------|--------------------------------------------------|-----------------------|---------------------------------------- -magneticConstant | μ0 | 1.2566370614e-6 | N · A-2 -electricConstant | ε0 | 8.854187817e-12 | F · m-1 -vacuumImpedance | Z0 | 376.730313461 | Ω -coulomb | κ | 8.9875517873681764e9 | N · m2 · C-2 -elementaryCharge | e | 1.60217656535e-19 | C -bohrMagneton | μB | 9.2740096820e-24 | J · T-1 -conductanceQuantum | G0 | 7.748091734625e-5 | S -inverseConductanceQuantum | G0-1 | 12906.403721742 | Ω -magneticFluxQuantum | f0 | 2.06783375846e-15 | Wb -nuclearMagneton | μN | 5.0507835311e-27 | J · T-1 -klitzing | RK | 25812.807443484 | Ω +magneticConstant | μ0 | 1.25663706212e-6 | N · A-2 +electricConstant | ε0 | 8.8541878128e-12 | F · m-1 +vacuumImpedance | Z0 | 376.730313667 | Ω +coulomb | κ | 8.987551792261171e9 | N · m2 · C-2 +elementaryCharge | e | 1.602176634e-19 | C +bohrMagneton | μB | 9.2740100783e-24 | J · T-1 +conductanceQuantum | G0 | 7.748091729863649e-5 | S +inverseConductanceQuantum | G0-1 | 12906.403729652257 | Ω +magneticFluxQuantum | f0 | 2.0678338484619295e-15 | Wb +nuclearMagneton | μN | 5.0507837461e-27 | J · T-1 +klitzing | RK | 25812.807459304513 | Ω /g, '') // skip the commented-out rows + + const rows = section.split('\n') + .map(line => line.split('|').map(cell => cell.trim())) + .filter(cells => cells.length === 4 && cells[2] !== '' && !isNaN(Number(cells[2]))) + + assert(rows.length > 40, 'the table should be found') + for (const [name, , value] of rows) { + const constant = math[name] + let actual + if (typeof constant === 'number') { + actual = constant // dimensionless constants such as fineStructure + } else if (constant !== undefined) { + actual = constant.toNumber() + } else { + // adopted values such as atm are units, not constants + assert(math.Unit.isValuelessUnit(name), `${name} should be a physical constant or a unit`) + actual = math.unit(1, name).toSI().toNumber() + } + approxEqual(Number(value), actual, 1e-12) + } + }) +}) diff --git a/tools/update-authors.js b/tools/update-authors.js index 0f4c574e6a..0e3a218d75 100644 --- a/tools/update-authors.js +++ b/tools/update-authors.js @@ -92,6 +92,14 @@ const replaceEmails = { author: 'Hugohong258', email: '' }, + '<24110399@iitgn.ac.in>': { + author: 'Yash Goyal', + email: '' + }, + '<116227558+JSap0914@users.noreply.github.com>': { + author: 'JSap0914', + email: '' + } } // Commits from which we do not want the author to pop up in the AUTHORS list,