Skip to content

Commit 123d4aa

Browse files
committed
fix: #3472 rename physical constant coulomb to coulombConstant
1 parent ee7dc26 commit 123d4aa

File tree

8 files changed

+13
-4
lines changed

8 files changed

+13
-4
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- Fix: #3482 mathjs throwing an error related to `BigInt` when loading in
66
specific environments.
77
- Fix: syntax section of function `numeric` (see #3448).
8+
- Fix: #3472 rename physical constant `coulomb` to `coulombConstant`. The old
9+
name is still available for backward compatibility.
810

911
# 2025-05-21, 14.5.0
1012

src/expression/embeddedDocs/embeddedDocs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export const embeddedDocs = {
295295
magneticConstant: { description: 'Magnetic constant (vacuum permeability)', examples: ['magneticConstant'] },
296296
electricConstant: { description: 'Electric constant (vacuum permeability)', examples: ['electricConstant'] },
297297
vacuumImpedance: { description: 'Characteristic impedance of vacuum', examples: ['vacuumImpedance'] },
298-
coulomb: { description: 'Coulomb\'s constant', examples: ['coulomb'] },
298+
coulombConstant: { description: 'Coulomb\'s constant', examples: ['coulombConstant'] },
299299
elementaryCharge: { description: 'Elementary charge', examples: ['elementaryCharge'] },
300300
bohrMagneton: { description: 'Bohr magneton', examples: ['bohrMagneton'] },
301301
conductanceQuantum: { description: 'Conductance quantum', examples: ['conductanceQuantum'] },

src/factoriesAny.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ export {
297297
createClassicalElectronRadius,
298298
createConductanceQuantum,
299299
createCoulomb,
300+
createCoulombConstant,
300301
createDeuteronMass,
301302
createEfimovFactor,
302303
createElectricConstant,

src/type/unit/physicalConstants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export const createReducedPlanckConstant = /* #__PURE__ */ unitFactory('reducedP
1212
export const createMagneticConstant = /* #__PURE__ */ unitFactory('magneticConstant', '1.25663706212e-6', 'N A^-2')
1313
export const createElectricConstant = /* #__PURE__ */ unitFactory('electricConstant', '8.8541878128e-12', 'F m^-1')
1414
export const createVacuumImpedance = /* #__PURE__ */ unitFactory('vacuumImpedance', '376.730313667', 'ohm')
15-
export const createCoulomb = /* #__PURE__ */ unitFactory('coulomb', '8.987551792261171e9', 'N m^2 C^-2')
15+
export const createCoulomb = /* #__PURE__ */ unitFactory('coulomb', '8.987551792261171e9', 'N m^2 C^-2') // Deprecated in favor of coulombConstant
16+
export const createCoulombConstant = /* #__PURE__ */ unitFactory('coulombConstant', '8.987551792261171e9', 'N m^2 C^-2')
1617
export const createElementaryCharge = /* #__PURE__ */ unitFactory('elementaryCharge', '1.602176634e-19', 'C')
1718
export const createBohrMagneton = /* #__PURE__ */ unitFactory('bohrMagneton', '9.2740100783e-24', 'J T^-1')
1819
export const createConductanceQuantum = /* #__PURE__ */ unitFactory('conductanceQuantum', '7.748091729863649e-5', 'S')

src/utils/snapshot.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export function createSnapshotFromFactories (factories) {
159159
'compile',
160160
'parser',
161161
'chain',
162+
'coulomb',
162163
'reviver',
163164
'replacer'
164165
])

test/node-tests/doc.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const knownUndocumented = new Set([
243243
'conductanceQuantum',
244244
'ConstantNode',
245245
'coulomb',
246+
'coulombConstant',
246247
'createUnit',
247248
'DenseMatrix',
248249
'deuteronMass',

test/unit-tests/expression/function/help.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let mathDocs = math.create(math.all)
66
const originalConfig = mathDocs.config()
77
// Add names to the skipDocs array if they are not meant to have embedded docs
88
const skipDocs = new Set(['import', 'addScalar', 'divideScalar', 'equalScalar', 'multiplyScalar',
9-
'subtractScalar', 'apply', 'replacer', 'reviver'])
9+
'subtractScalar', 'apply', 'replacer', 'reviver', 'coulomb'])
1010

1111
// Add names to skipExamples if their examples in the embedded docs contain acceptable errors
1212
const skipExamples = new Set([])
@@ -22,7 +22,7 @@ const testExamples = new Set([...testDocs].filter(name => {
2222

2323
function runExamplesInDocs (name) {
2424
mathDocs.config(originalConfig)
25-
// every funciton should have doc.examples
25+
// every function should have doc.examples
2626
const examples = mathDocs.evaluate(`help("${name}")`).doc.examples
2727
try {
2828
// validate if the examples run without errors

test/unit-tests/type/unit/physicalConstants.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
createClassicalElectronRadius,
1010
createConductanceQuantum,
1111
createCoulomb,
12+
createCoulombConstant,
1213
createDeuteronMass,
1314
createEfimovFactor,
1415
createElectricConstant,
@@ -78,6 +79,8 @@ describe('physical constants', function () {
7879
assert.strictEqual(createElectricConstant(dependencies).toString(), '8.8541878128e-12 F / m')
7980
assert.strictEqual(createVacuumImpedance(dependencies).toString(), '376.730313667 ohm')
8081
assert.strictEqual(createCoulomb(dependencies).toString(), '8.987551792261171e+9 (N m^2) / C^2')
82+
assert.strictEqual(createCoulombConstant(dependencies).toString(), '8.987551792261171e+9 (N m^2) / C^2')
83+
assert.strictEqual(math.coulombConstant.toString(), '8.987551792261171e+9 (N m^2) / C^2')
8184
assert.strictEqual(createElementaryCharge(dependencies).toString(), '1.602176634e-19 C')
8285
assert.strictEqual(createBohrMagneton(dependencies).toString(), '9.2740100783e-24 J / T')
8386
assert.strictEqual(createConductanceQuantum(dependencies).toString(), '7.748091729863649e-5 S')

0 commit comments

Comments
 (0)