math-exercises 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +2 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/index.d.ts +2 -0
- package/lib/exercises/math/calcul/proportionality/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/index.js +2 -0
- package/lib/exercises/math/calcul/proportionality/scaleCalculation.d.ts +9 -0
- package/lib/exercises/math/calcul/proportionality/scaleCalculation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/scaleCalculation.js +90 -0
- package/lib/exercises/math/calcul/proportionality/scaleUsage.d.ts +9 -0
- package/lib/exercises/math/calcul/proportionality/scaleUsage.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/scaleUsage.js +95 -0
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts +7 -0
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +59 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +77 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/index.js +2 -0
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +18 -4
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts +10 -0
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +81 -0
- package/lib/exercises/math/functions/affines/index.d.ts +1 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +1 -0
- package/lib/exercises/pc/calibrationCurveOfSolution.js +1 -1
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +1 -1
- package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/calculateProtonsNumberFromMass.js +3 -3
- package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/calculateVolumetricMass.js +29 -4
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +6 -6
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomicStructureElement.js +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromElectronicConfiguration.js +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findValenceElectronsNumberFromTable.js +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +1 -1
- package/lib/exercises/pc/chemicalElements/index.d.ts +1 -0
- package/lib/exercises/pc/chemicalElements/index.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/index.js +1 -0
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts +11 -0
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.d.ts.map +1 -0
- package/lib/exercises/pc/chemicalElements/massOrVolumeProportion.js +99 -0
- package/lib/exercises/pc/chemicalEquations.d.ts +1 -1
- package/lib/exercises/pc/chemicalEquations.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalEquations.js +1 -1
- package/lib/exercises/pc/chemicalReactions/index.d.ts +2 -0
- package/lib/exercises/pc/chemicalReactions/index.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/index.js +2 -0
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts +5 -0
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts.map +1 -0
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +69 -0
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts +11 -0
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.d.ts.map +1 -0
- package/lib/exercises/pc/chemicalReactions/titrationEquivalenceRelation.js +180 -0
- package/lib/exercises/pc/chemicalReactionsProduct.d.ts +1 -1
- package/lib/exercises/pc/chemicalReactionsProduct.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactionsProduct.js +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.js +1 -1
- package/lib/exercises/pc/dosage/concentrationCalculation.d.ts +10 -0
- package/lib/exercises/pc/dosage/concentrationCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/dosage/concentrationCalculation.js +118 -0
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts +10 -0
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +116 -0
- package/lib/exercises/pc/dosage/index.d.ts +2 -0
- package/lib/exercises/pc/dosage/index.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/index.js +2 -0
- package/lib/exercises/pc/electricity/calculateIntensity.d.ts +8 -0
- package/lib/exercises/pc/electricity/calculateIntensity.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/calculateIntensity.js +60 -0
- package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.d.ts +10 -0
- package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/calculateIntensityInSerieOrParallel.js +105 -0
- package/lib/exercises/pc/electricity/calculateVoltage.d.ts +11 -0
- package/lib/exercises/pc/electricity/calculateVoltage.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/calculateVoltage.js +143 -0
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts +9 -0
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/electricPowerOrEnergyCalculation.js +80 -0
- package/lib/exercises/pc/electricity/index.d.ts +7 -0
- package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/index.js +7 -0
- package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.d.ts +10 -0
- package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/kirchhoffVoltageLaw.js +110 -0
- package/lib/exercises/pc/electricity/ohmLaw.d.ts +11 -0
- package/lib/exercises/pc/electricity/ohmLaw.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/ohmLaw.js +122 -0
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts +5 -0
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +94 -0
- package/lib/exercises/pc/energy/calorificValue.d.ts +8 -0
- package/lib/exercises/pc/energy/calorificValue.d.ts.map +1 -0
- package/lib/exercises/pc/energy/calorificValue.js +77 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts +8 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy.d.ts.map +1 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy.js +77 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts +11 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy2.d.ts.map +1 -0
- package/lib/exercises/pc/energy/combustionTransferEnergy2.js +140 -0
- package/lib/exercises/pc/energy/efficencyOfConverter.d.ts +8 -0
- package/lib/exercises/pc/energy/efficencyOfConverter.d.ts.map +1 -0
- package/lib/exercises/pc/energy/efficencyOfConverter.js +83 -0
- package/lib/exercises/pc/energy/efficiencyCalculation.d.ts +10 -0
- package/lib/exercises/pc/energy/efficiencyCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/energy/efficiencyCalculation.js +121 -0
- package/lib/exercises/pc/energy/energyTransfer.d.ts +10 -0
- package/lib/exercises/pc/energy/energyTransfer.d.ts.map +1 -0
- package/lib/exercises/pc/energy/energyTransfer.js +67 -0
- package/lib/exercises/pc/energy/index.d.ts +9 -0
- package/lib/exercises/pc/energy/index.d.ts.map +1 -0
- package/lib/exercises/pc/energy/index.js +24 -0
- package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts +10 -0
- package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.d.ts.map +1 -0
- package/lib/exercises/pc/energy/kineticEnergyOrMassOrSpeed.js +167 -0
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts +11 -0
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +142 -0
- package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts +8 -0
- package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.d.ts.map +1 -0
- package/lib/exercises/pc/forces/calculateNormalOrFrictionForce.js +101 -0
- package/lib/exercises/pc/forces/electroStaticForce.d.ts +13 -0
- package/lib/exercises/pc/forces/electroStaticForce.d.ts.map +1 -0
- package/lib/exercises/pc/forces/electroStaticForce.js +116 -0
- package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts +9 -0
- package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.d.ts.map +1 -0
- package/lib/exercises/pc/forces/gravitationalAttractionObjectHeight.js +131 -0
- package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts +1 -0
- package/lib/exercises/pc/forces/gravitationalAttractionValue.d.ts.map +1 -1
- package/lib/exercises/pc/forces/gravitationalAttractionValue.js +31 -27
- package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts +10 -0
- package/lib/exercises/pc/forces/gravitationalForcePlanets.d.ts.map +1 -0
- package/lib/exercises/pc/forces/gravitationalForcePlanets.js +117 -0
- package/lib/exercises/pc/forces/index.d.ts +5 -0
- package/lib/exercises/pc/forces/index.d.ts.map +1 -1
- package/lib/exercises/pc/forces/index.js +6 -0
- package/lib/exercises/pc/forces/massWeight.d.ts +9 -0
- package/lib/exercises/pc/forces/massWeight.d.ts.map +1 -0
- package/lib/exercises/pc/forces/massWeight.js +67 -0
- package/lib/exercises/pc/forces/pressureDifferenceCalculation.d.ts +1 -0
- package/lib/exercises/pc/forces/pressureDifferenceCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/forces/pressureDifferenceCalculation.js +106 -0
- package/lib/exercises/pc/formulaFromComposition.js +2 -2
- package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.d.ts +8 -0
- package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.d.ts.map +1 -0
- package/lib/exercises/pc/identifyAtomicMassOrAtomicNb.js +72 -0
- package/lib/exercises/pc/index.d.ts +6 -0
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +6 -0
- package/lib/exercises/pc/molarQuantity.js +2 -2
- package/lib/exercises/pc/mole/index.d.ts +2 -0
- package/lib/exercises/pc/mole/index.d.ts.map +1 -1
- package/lib/exercises/pc/mole/index.js +2 -0
- package/lib/exercises/pc/mole/molarMass.js +1 -1
- package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.d.ts +9 -0
- package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.d.ts.map +1 -0
- package/lib/exercises/pc/mole/moleculeCountFromMassAndAvogadro.js +75 -0
- package/lib/exercises/pc/mole/moleculeCountFromMol.d.ts +7 -0
- package/lib/exercises/pc/mole/moleculeCountFromMol.d.ts.map +1 -0
- package/lib/exercises/pc/mole/moleculeCountFromMol.js +66 -0
- package/lib/exercises/pc/moleculeFormula.js +1 -1
- package/lib/exercises/pc/moleculeNomenclature.js +1 -1
- package/lib/exercises/pc/motion/averageSpeed.d.ts +12 -0
- package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -0
- package/lib/exercises/pc/motion/averageSpeed.js +121 -0
- package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts +10 -0
- package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -0
- package/lib/exercises/pc/motion/averageSpeedCalculation.js +145 -0
- package/lib/exercises/pc/motion/characteristicsOfVelocityVector.d.ts +7 -0
- package/lib/exercises/pc/motion/characteristicsOfVelocityVector.d.ts.map +1 -0
- package/lib/exercises/pc/motion/characteristicsOfVelocityVector.js +86 -0
- package/lib/exercises/pc/motion/index.d.ts +7 -0
- package/lib/exercises/pc/motion/index.d.ts.map +1 -0
- package/lib/exercises/pc/motion/index.js +22 -0
- package/lib/exercises/pc/motion/motionReference.d.ts +9 -0
- package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -0
- package/lib/exercises/pc/motion/motionReference.js +167 -0
- package/lib/exercises/pc/motion/typeOfAcceleration.d.ts +5 -0
- package/lib/exercises/pc/motion/typeOfAcceleration.d.ts.map +1 -0
- package/lib/exercises/pc/motion/typeOfAcceleration.js +97 -0
- package/lib/exercises/pc/motion/typeOfMovement.d.ts +5 -0
- package/lib/exercises/pc/motion/typeOfMovement.d.ts.map +1 -0
- package/lib/exercises/pc/motion/typeOfMovement.js +111 -0
- package/lib/exercises/pc/orderOfMagnitude.d.ts +8 -0
- package/lib/exercises/pc/orderOfMagnitude.d.ts.map +1 -0
- package/lib/exercises/pc/orderOfMagnitude.js +68 -0
- package/lib/exercises/pc/potentialEnergy.d.ts.map +1 -1
- package/lib/exercises/pc/potentialEnergy.js +17 -5
- package/lib/exercises/pc/power/calculatePowerOfLight.d.ts +8 -0
- package/lib/exercises/pc/power/calculatePowerOfLight.d.ts.map +1 -0
- package/lib/exercises/pc/power/calculatePowerOfLight.js +85 -0
- package/lib/exercises/pc/power/index.d.ts +2 -0
- package/lib/exercises/pc/power/index.d.ts.map +1 -0
- package/lib/exercises/pc/power/index.js +17 -0
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts +5 -0
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts.map +1 -0
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +117 -0
- package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.d.ts +9 -0
- package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.d.ts.map +1 -0
- package/lib/exercises/pc/sound/findPeriodOrFrequencyFromGraph.js +95 -0
- package/lib/exercises/pc/sound/index.d.ts +1 -0
- package/lib/exercises/pc/sound/index.d.ts.map +1 -1
- package/lib/exercises/pc/sound/index.js +1 -0
- package/lib/exercises/pc/waves/index.d.ts +1 -0
- package/lib/exercises/pc/waves/index.d.ts.map +1 -1
- package/lib/exercises/pc/waves/index.js +1 -0
- package/lib/exercises/pc/waves/lightDistanceConversion.d.ts +10 -0
- package/lib/exercises/pc/waves/lightDistanceConversion.d.ts.map +1 -0
- package/lib/exercises/pc/waves/lightDistanceConversion.js +160 -0
- package/lib/exercises/pc/weight/calculateWeight.d.ts +7 -0
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -0
- package/lib/exercises/pc/weight/calculateWeight.js +72 -0
- package/lib/exercises/pc/weight/index.d.ts +1 -0
- package/lib/exercises/pc/weight/index.d.ts.map +1 -1
- package/lib/exercises/pc/weight/index.js +1 -0
- package/lib/exercises/pc/weight/weightOnTheMoon.d.ts.map +1 -1
- package/lib/exercises/pc/weight/weightOnTheMoon.js +6 -6
- package/lib/exercises/utils/getAtoms.d.ts +1 -1
- package/lib/exercises/utils/getAtoms.d.ts.map +1 -1
- package/lib/exercises/utils/getAtoms.js +1 -1
- package/lib/geogebra/deleteObjectNamesFromAnswer.d.ts +1 -1
- package/lib/geogebra/deleteObjectNamesFromAnswer.d.ts.map +1 -1
- package/lib/geogebra/deleteObjectNamesFromAnswer.js +2 -2
- package/lib/index.d.ts +188 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -2
- package/lib/math/numbers/reals/extendedRingElement.d.ts.map +1 -1
- package/lib/math/polynomials/affine.d.ts +4 -0
- package/lib/math/polynomials/affine.d.ts.map +1 -1
- package/lib/math/polynomials/affine.js +10 -0
- package/lib/math/polynomials/trinom.d.ts +2 -1
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.js +3 -0
- package/lib/pc/constants/atoms.d.ts +0 -1
- package/lib/pc/constants/atoms.d.ts.map +1 -1
- package/lib/pc/constants/atoms.js +2 -2
- package/lib/pc/constants/coulomb.d.ts +3 -0
- package/lib/pc/constants/coulomb.d.ts.map +1 -0
- package/lib/pc/constants/coulomb.js +13 -0
- package/lib/pc/constants/earth.d.ts +0 -1
- package/lib/pc/constants/earth.d.ts.map +1 -1
- package/lib/pc/constants/earth.js +4 -4
- package/lib/pc/constants/gravity.d.ts +1 -1
- package/lib/pc/constants/gravity.d.ts.map +1 -1
- package/lib/pc/constants/gravity.js +16 -7
- package/lib/pc/constants/mechanics/gravitational.d.ts +14 -0
- package/lib/pc/constants/mechanics/gravitational.d.ts.map +1 -0
- package/lib/pc/constants/mechanics/gravitational.js +37 -0
- package/lib/pc/constants/mechanics/planets.d.ts +15 -0
- package/lib/pc/constants/mechanics/planets.d.ts.map +1 -0
- package/lib/pc/constants/mechanics/planets.js +35 -0
- package/lib/pc/constants/mechanics/waves.d.ts +8 -0
- package/lib/pc/constants/mechanics/waves.d.ts.map +1 -0
- package/lib/pc/constants/mechanics/waves.js +8 -0
- package/lib/pc/constants/molecularChemistry/atomSymbols.d.ts +2 -0
- package/lib/pc/constants/molecularChemistry/atomSymbols.d.ts.map +1 -0
- package/lib/pc/constants/molecularChemistry/atomSymbols.js +2 -0
- package/lib/pc/constants/molecularChemistry/atome.d.ts +18 -0
- package/lib/pc/constants/molecularChemistry/atome.d.ts.map +1 -0
- package/lib/pc/constants/molecularChemistry/atome.js +174 -0
- package/lib/pc/constants/molecularChemistry/atoms.d.ts +9 -0
- package/lib/pc/constants/molecularChemistry/atoms.d.ts.map +1 -0
- package/lib/pc/constants/molecularChemistry/atoms.js +15 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts +25 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -0
- package/lib/pc/constants/molecularChemistry/molecule.js +579 -0
- package/lib/pc/constants/molecularChemistry/reaction.d.ts +27 -0
- package/lib/pc/constants/molecularChemistry/reaction.d.ts.map +1 -0
- package/lib/pc/constants/molecularChemistry/reaction.js +471 -0
- package/lib/pc/measure/measure.d.ts +16 -6
- package/lib/pc/measure/measure.d.ts.map +1 -1
- package/lib/pc/measure/measure.js +112 -16
- package/lib/pc/units/AmountOfSubstance.d.ts +17 -0
- package/lib/pc/units/AmountOfSubstance.d.ts.map +1 -0
- package/lib/pc/units/AmountOfSubstance.js +40 -0
- package/lib/pc/units/PressionUnit.d.ts +17 -0
- package/lib/pc/units/PressionUnit.d.ts.map +1 -0
- package/lib/pc/units/PressionUnit.js +32 -0
- package/lib/pc/units/distanceUnits.d.ts +16 -0
- package/lib/pc/units/distanceUnits.d.ts.map +1 -0
- package/lib/pc/units/distanceUnits.js +32 -0
- package/lib/pc/units/divideUnit.d.ts +13 -0
- package/lib/pc/units/divideUnit.d.ts.map +1 -0
- package/lib/pc/units/divideUnit.js +32 -0
- package/lib/pc/units/electricalChargeUnit.d.ts +17 -0
- package/lib/pc/units/electricalChargeUnit.d.ts.map +1 -0
- package/lib/pc/units/electricalChargeUnit.js +40 -0
- package/lib/pc/units/electricalResistanceUnit.d.ts +18 -0
- package/lib/pc/units/electricalResistanceUnit.d.ts.map +1 -0
- package/lib/pc/units/electricalResistanceUnit.js +32 -0
- package/lib/pc/units/electricalUnit.d.ts +18 -0
- package/lib/pc/units/electricalUnit.d.ts.map +1 -0
- package/lib/pc/units/electricalUnit.js +32 -0
- package/lib/pc/units/energyUnit.d.ts +16 -0
- package/lib/pc/units/energyUnit.d.ts.map +1 -0
- package/lib/pc/units/energyUnit.js +32 -0
- package/lib/pc/units/forceUnits.d.ts +16 -0
- package/lib/pc/units/forceUnits.d.ts.map +1 -0
- package/lib/pc/units/forceUnits.js +32 -0
- package/lib/pc/units/frequenceUnit.d.ts +17 -0
- package/lib/pc/units/frequenceUnit.d.ts.map +1 -0
- package/lib/pc/units/frequenceUnit.js +40 -0
- package/lib/pc/units/interfaces/baseTenUnit.d.ts +10 -0
- package/lib/pc/units/interfaces/baseTenUnit.d.ts.map +1 -0
- package/lib/pc/units/interfaces/baseTenUnit.js +16 -0
- package/lib/pc/units/interfaces/basicUnit.d.ts +13 -0
- package/lib/pc/units/interfaces/basicUnit.d.ts.map +1 -0
- package/lib/pc/units/interfaces/basicUnit.js +19 -0
- package/lib/pc/units/interfaces/unit.d.ts +13 -0
- package/lib/pc/units/interfaces/unit.d.ts.map +1 -0
- package/lib/pc/units/interfaces/unit.js +2 -0
- package/lib/pc/units/massUnits.d.ts +17 -0
- package/lib/pc/units/massUnits.d.ts.map +1 -0
- package/lib/pc/units/massUnits.js +32 -0
- package/lib/pc/units/mulitplyUnits.d.ts +13 -0
- package/lib/pc/units/mulitplyUnits.d.ts.map +1 -0
- package/lib/pc/units/mulitplyUnits.js +26 -0
- package/lib/pc/units/powerUnits.d.ts +14 -0
- package/lib/pc/units/powerUnits.d.ts.map +1 -0
- package/lib/pc/units/powerUnits.js +26 -0
- package/lib/pc/units/timeUnits.d.ts +13 -0
- package/lib/pc/units/timeUnits.d.ts.map +1 -0
- package/lib/pc/units/timeUnits.js +42 -0
- package/lib/pc/units/volumeUnit.d.ts +17 -0
- package/lib/pc/units/volumeUnit.d.ts.map +1 -0
- package/lib/pc/units/volumeUnit.js +32 -0
- package/lib/pc/units/wattUnit.d.ts +17 -0
- package/lib/pc/units/wattUnit.d.ts.map +1 -0
- package/lib/pc/units/wattUnit.js +32 -0
- package/lib/server.d.ts.map +1 -1
- package/lib/server.js +6 -6
- package/lib/tree/nodes/node.d.ts +3 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +32 -10
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.molecules = exports.Reaction = exports.ReactionConstructor = void 0;
|
|
4
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
|
+
const molecule_1 = require("./molecule");
|
|
6
|
+
Object.defineProperty(exports, "molecules", { enumerable: true, get: function () { return molecule_1.molecules; } });
|
|
7
|
+
class ReactionConstructor {
|
|
8
|
+
static randomReaction() {
|
|
9
|
+
const reactionsData = [
|
|
10
|
+
[
|
|
11
|
+
{ coefficient: -2, species: "H_2" },
|
|
12
|
+
{ coefficient: -2, species: "O_2" },
|
|
13
|
+
{ coefficient: 2, species: "H_2O" },
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
{ coefficient: -1, species: "CH_4" },
|
|
17
|
+
{ coefficient: 2, species: "O_2" },
|
|
18
|
+
{ coefficient: 1, species: "CO_2" },
|
|
19
|
+
{ coefficient: 2, species: "H_2O" },
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
{ coefficient: -2, species: "Mg" },
|
|
23
|
+
{ coefficient: -1, species: "O_2" },
|
|
24
|
+
{ coefficient: 2, species: "MgO" },
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
{ coefficient: -2, species: "H_2O" },
|
|
28
|
+
{ coefficient: 2, species: "H_2" },
|
|
29
|
+
{ coefficient: 1, species: "O_2" },
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
{ coefficient: -4, species: "Fe" },
|
|
33
|
+
{ coefficient: -3, species: "O_2" },
|
|
34
|
+
{ coefficient: 2, species: "Fe_2O_3" },
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
{ coefficient: -1, species: "HCl" },
|
|
38
|
+
{ coefficient: -1, species: "NaOH" },
|
|
39
|
+
{ coefficient: 1, species: "NaCl" },
|
|
40
|
+
{ coefficient: 1, species: "H_2O" },
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
{ coefficient: -1, species: "AgNO_3" },
|
|
44
|
+
{ coefficient: -1, species: "NaCl" },
|
|
45
|
+
{ coefficient: 1, species: "AgCl" },
|
|
46
|
+
{ coefficient: 1, species: "NaNO_3" },
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
50
|
+
{ coefficient: -1, species: "Ca(OH)_2" },
|
|
51
|
+
{ coefficient: 1, species: "CaSO_4" },
|
|
52
|
+
{ coefficient: 2, species: "H_2O" },
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
{ coefficient: -1, species: "C_6H_{12}O_6" },
|
|
56
|
+
{ coefficient: 2, species: "C_2H_5OH" },
|
|
57
|
+
{ coefficient: 2, species: "CO_2" },
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
{ coefficient: -1, species: "C_2H_5OH" },
|
|
61
|
+
{ coefficient: -3, species: "O_2" },
|
|
62
|
+
{ coefficient: 2, species: "CO_2" },
|
|
63
|
+
{ coefficient: 3, species: "H_2O" },
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
{ coefficient: -1, species: "CuSO_4" },
|
|
67
|
+
{ coefficient: -2, species: "NaOH" },
|
|
68
|
+
{ coefficient: 1, species: "Cu(OH)_2" },
|
|
69
|
+
{ coefficient: 1, species: "Na_2SO_4" },
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
{ coefficient: -1, species: "C_2H_4" },
|
|
73
|
+
{ coefficient: -3, species: "O_2" },
|
|
74
|
+
{ coefficient: 2, species: "CO_2" },
|
|
75
|
+
{ coefficient: 2, species: "H_2O" },
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
{ coefficient: -1, species: "Zn" },
|
|
79
|
+
{ coefficient: -2, species: "HCl" },
|
|
80
|
+
{ coefficient: 1, species: "ZnCl_2" },
|
|
81
|
+
{ coefficient: 1, species: "H_2" },
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
85
|
+
{ coefficient: -2, species: "KOH" },
|
|
86
|
+
{ coefficient: 1, species: "K_2SO_4" },
|
|
87
|
+
{ coefficient: 2, species: "H_2O" },
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
{ coefficient: -2, species: "H_2O_2" },
|
|
91
|
+
{ coefficient: 2, species: "H_2O" },
|
|
92
|
+
{ coefficient: 1, species: "O_2" },
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
{ coefficient: -1, species: "PbCl_2" },
|
|
96
|
+
{ coefficient: -2, species: "KI" },
|
|
97
|
+
{ coefficient: 1, species: "PbI_2" },
|
|
98
|
+
{ coefficient: 2, species: "KCl" },
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
{ coefficient: -1, species: "C_3H_8" },
|
|
102
|
+
{ coefficient: -5, species: "O_2" },
|
|
103
|
+
{ coefficient: 3, species: "CO_2" },
|
|
104
|
+
{ coefficient: 4, species: "H_2O" },
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
{ coefficient: -1, species: "CH_3COOH" },
|
|
108
|
+
{ coefficient: -1, species: "NaOH" },
|
|
109
|
+
{ coefficient: 1, species: "CH_3COONa" },
|
|
110
|
+
{ coefficient: 1, species: "H_2O" },
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
{ coefficient: -1, species: "S" },
|
|
114
|
+
{ coefficient: -1, species: "O_2" },
|
|
115
|
+
{ coefficient: 1, species: "SO_2" },
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
{ coefficient: -1, species: "Ba(NO_3)_2" },
|
|
119
|
+
{ coefficient: -1, species: "Na_2SO_4" },
|
|
120
|
+
{ coefficient: 1, species: "BaSO_4" },
|
|
121
|
+
{ coefficient: 2, species: "NaNO_3" },
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
{ coefficient: -1, species: "C_4H_{10}" },
|
|
125
|
+
{ coefficient: -6, species: "O_2" },
|
|
126
|
+
{ coefficient: 4, species: "CO_2" },
|
|
127
|
+
{ coefficient: 5, species: "H_2O" },
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
{ coefficient: -1, species: "Cu" },
|
|
131
|
+
{ coefficient: -2, species: "AgNO_3" },
|
|
132
|
+
{ coefficient: 1, species: "Cu(NO_3)_2" },
|
|
133
|
+
{ coefficient: 2, species: "Ag" },
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
{ coefficient: -2, species: "HCl" },
|
|
137
|
+
{ coefficient: -1, species: "Mg(OH)_2" },
|
|
138
|
+
{ coefficient: 1, species: "MgCl_2" },
|
|
139
|
+
{ coefficient: 2, species: "H_2O" },
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
{ coefficient: -2, species: "KClO_3" },
|
|
143
|
+
{ coefficient: 2, species: "KCl" },
|
|
144
|
+
{ coefficient: 3, species: "O_2" },
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
{ coefficient: -1, species: "PbSO_4" },
|
|
148
|
+
{ coefficient: -2, species: "NaCl" },
|
|
149
|
+
{ coefficient: 1, species: "PbCl_2" },
|
|
150
|
+
{ coefficient: 1, species: "Na_2SO_4" },
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
{ coefficient: -1, species: "NH_4NO_3" },
|
|
154
|
+
{ coefficient: -1, species: "NaCl" },
|
|
155
|
+
{ coefficient: 1, species: "NH_4Cl" },
|
|
156
|
+
{ coefficient: 1, species: "NaNO_3" },
|
|
157
|
+
],
|
|
158
|
+
[
|
|
159
|
+
{ coefficient: -2, species: "H_3PO_4" },
|
|
160
|
+
{ coefficient: -3, species: "Ca(OH)_2" },
|
|
161
|
+
{ coefficient: 1, species: "Ca_3(PO_4)_2" },
|
|
162
|
+
{ coefficient: 6, species: "H_2O" },
|
|
163
|
+
],
|
|
164
|
+
[
|
|
165
|
+
{ coefficient: -1, species: "S_8" },
|
|
166
|
+
{ coefficient: -8, species: "O_2" },
|
|
167
|
+
{ coefficient: 8, species: "SO_2" },
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
{ coefficient: -1, species: "AgNO_3" },
|
|
171
|
+
{ coefficient: -1, species: "KCl" },
|
|
172
|
+
{ coefficient: 1, species: "AgCl" },
|
|
173
|
+
{ coefficient: 1, species: "KNO_3" },
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
{ coefficient: -1, species: "N_2" },
|
|
177
|
+
{ coefficient: -3, species: "H_2" },
|
|
178
|
+
{ coefficient: 2, species: "NH_3" },
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
{ coefficient: -1, species: "C_6H_{12}O_6" },
|
|
182
|
+
{ coefficient: -6, species: "O_2" },
|
|
183
|
+
{ coefficient: 6, species: "CO_2" },
|
|
184
|
+
{ coefficient: 6, species: "H_2O" },
|
|
185
|
+
],
|
|
186
|
+
[
|
|
187
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
188
|
+
{ coefficient: -2, species: "NaOH" },
|
|
189
|
+
{ coefficient: 1, species: "Na_2SO_4" },
|
|
190
|
+
{ coefficient: 2, species: "H_2O" },
|
|
191
|
+
],
|
|
192
|
+
[
|
|
193
|
+
{ coefficient: -1, species: "Pb(NO_3)_2" },
|
|
194
|
+
{ coefficient: -1, species: "Na_2SO_4" },
|
|
195
|
+
{ coefficient: 1, species: "PbSO_4" },
|
|
196
|
+
{ coefficient: 2, species: "NaNO_3" },
|
|
197
|
+
],
|
|
198
|
+
[
|
|
199
|
+
{ coefficient: -1, species: "CaCO_3" },
|
|
200
|
+
{ coefficient: 1, species: "CaO" },
|
|
201
|
+
{ coefficient: 1, species: "CO_2" },
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
{ coefficient: -1, species: "Fe" },
|
|
205
|
+
{ coefficient: -1, species: "CuCl_2" },
|
|
206
|
+
{ coefficient: 1, species: "Cu" },
|
|
207
|
+
{ coefficient: 1, species: "FeCl_2" },
|
|
208
|
+
],
|
|
209
|
+
[
|
|
210
|
+
{ coefficient: -1, species: "H_2" },
|
|
211
|
+
{ coefficient: -1, species: "Cl_2" },
|
|
212
|
+
{ coefficient: 2, species: "HCl" },
|
|
213
|
+
],
|
|
214
|
+
[
|
|
215
|
+
{ coefficient: -2, species: "AgNO_3" },
|
|
216
|
+
{ coefficient: -1, species: "NaCl" },
|
|
217
|
+
{ coefficient: 1, species: "AgCl" },
|
|
218
|
+
{ coefficient: 1, species: "NaNO_3" },
|
|
219
|
+
],
|
|
220
|
+
[
|
|
221
|
+
{ coefficient: -1, species: "NH_4NO_3" },
|
|
222
|
+
{ coefficient: 1, species: "N_2O" },
|
|
223
|
+
{ coefficient: 2, species: "H_2O" },
|
|
224
|
+
],
|
|
225
|
+
[
|
|
226
|
+
{ coefficient: -1, species: "S" },
|
|
227
|
+
{ coefficient: -1, species: "O_2" },
|
|
228
|
+
{ coefficient: 1, species: "SO_2" },
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
{ coefficient: -1, species: "PbSO_4" },
|
|
232
|
+
{ coefficient: -1, species: "Na_2SO_4" },
|
|
233
|
+
{ coefficient: 1, species: "PbSO_4" },
|
|
234
|
+
{ coefficient: 2, species: "NaNO_3" },
|
|
235
|
+
],
|
|
236
|
+
[
|
|
237
|
+
{ coefficient: -1, species: "N_2O_4" },
|
|
238
|
+
{ coefficient: 2, species: "NO_2" },
|
|
239
|
+
],
|
|
240
|
+
[
|
|
241
|
+
{ coefficient: -2, species: "C_4H_{10}" },
|
|
242
|
+
{ coefficient: -13, species: "O_2" },
|
|
243
|
+
{ coefficient: 8, species: "CO_2" },
|
|
244
|
+
{ coefficient: 10, species: "H_2O" },
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
{ coefficient: -2, species: "AgNO_3" },
|
|
248
|
+
{ coefficient: -1, species: "Cu" },
|
|
249
|
+
{ coefficient: 1, species: "Cu(NO_3)_2" },
|
|
250
|
+
{ coefficient: 2, species: "Ag" },
|
|
251
|
+
],
|
|
252
|
+
[
|
|
253
|
+
{ coefficient: -1, species: "C_6H_{12}O_6" },
|
|
254
|
+
{ coefficient: -6, species: "O_2" },
|
|
255
|
+
{ coefficient: 6, species: "CO_2" },
|
|
256
|
+
{ coefficient: 6, species: "H_2O" },
|
|
257
|
+
],
|
|
258
|
+
[
|
|
259
|
+
{ coefficient: -1, species: "Zn" },
|
|
260
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
261
|
+
{ coefficient: 1, species: "ZnSO_4" },
|
|
262
|
+
{ coefficient: 1, species: "H_2" },
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
{ coefficient: -1, species: "Na_2CO_3" },
|
|
266
|
+
{ coefficient: 1, species: "Na_2O" },
|
|
267
|
+
{ coefficient: 1, species: "CO_2" },
|
|
268
|
+
],
|
|
269
|
+
[
|
|
270
|
+
{ coefficient: -4, species: "NH_3" },
|
|
271
|
+
{ coefficient: -5, species: "O_2" },
|
|
272
|
+
{ coefficient: 4, species: "NO" },
|
|
273
|
+
{ coefficient: 6, species: "H_2O" },
|
|
274
|
+
],
|
|
275
|
+
[
|
|
276
|
+
{ coefficient: -4, species: "CO" },
|
|
277
|
+
{ coefficient: -1, species: "Fe_3O_4" },
|
|
278
|
+
{ coefficient: 4, species: "CO_2" },
|
|
279
|
+
{ coefficient: 3, species: "Fe" },
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
{ coefficient: -1, species: "Cu_2S" },
|
|
283
|
+
{ coefficient: -2, species: "Cu_2O" },
|
|
284
|
+
{ coefficient: 6, species: "Cu" },
|
|
285
|
+
{ coefficient: 1, species: "SO_2" },
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
{ coefficient: -1, species: "CH_4" },
|
|
289
|
+
{ coefficient: -2, species: "H_2O" },
|
|
290
|
+
{ coefficient: 1, species: "CO_2" },
|
|
291
|
+
{ coefficient: 4, species: "H_2" },
|
|
292
|
+
],
|
|
293
|
+
[
|
|
294
|
+
{ coefficient: -2, species: "NaCl" },
|
|
295
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
296
|
+
{ coefficient: 2, species: "HCl" },
|
|
297
|
+
{ coefficient: 1, species: "Na_2SO_4" },
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
{ coefficient: -1, species: "H_2SO_4" },
|
|
301
|
+
{ coefficient: -2, species: "H_2O" },
|
|
302
|
+
{ coefficient: 2, species: "H_3O^+" },
|
|
303
|
+
{ coefficient: 1, species: "SO_4^{2-}" },
|
|
304
|
+
],
|
|
305
|
+
[
|
|
306
|
+
{ coefficient: -1, species: "Fe" },
|
|
307
|
+
{ coefficient: -2, species: "H_3O^+" },
|
|
308
|
+
{ coefficient: 1, species: "Fe^{2+}" },
|
|
309
|
+
{ coefficient: 1, species: "H_2" },
|
|
310
|
+
{ coefficient: 1, species: "H_2O" },
|
|
311
|
+
],
|
|
312
|
+
[
|
|
313
|
+
{ coefficient: -1, species: "Cu^{2+}" },
|
|
314
|
+
{ coefficient: -2, species: "OH^-" },
|
|
315
|
+
{ coefficient: 1, species: "Cu(OH)_2" },
|
|
316
|
+
],
|
|
317
|
+
[
|
|
318
|
+
{ coefficient: -3, species: "Ag^+" },
|
|
319
|
+
{ coefficient: -1, species: "PO_4^{3-}" },
|
|
320
|
+
{ coefficient: 1, species: "Ag_3PO_4" },
|
|
321
|
+
],
|
|
322
|
+
];
|
|
323
|
+
for (const reaction of reactionsData) {
|
|
324
|
+
for (const reactionSpecies of reaction) {
|
|
325
|
+
const foundMolecule = molecule_1.molecules.find((molecule) => molecule.formula === reactionSpecies.species);
|
|
326
|
+
if (!foundMolecule) {
|
|
327
|
+
console.log(`La species '${reactionSpecies.species}' n'a pas été trouvée dans molecules.`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const selectedReaction = reactionsData[(0, randint_1.randint)(0, reactionsData.length)];
|
|
332
|
+
return new Reaction(selectedReaction.map((el) => {
|
|
333
|
+
return {
|
|
334
|
+
coefficient: el.coefficient,
|
|
335
|
+
species: molecule_1.molecules.find((m) => m.formula === el.species),
|
|
336
|
+
};
|
|
337
|
+
}));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
exports.ReactionConstructor = ReactionConstructor;
|
|
341
|
+
class Reaction {
|
|
342
|
+
constructor(reactionArray) {
|
|
343
|
+
this.reactionArray = reactionArray;
|
|
344
|
+
}
|
|
345
|
+
getReactants() {
|
|
346
|
+
return this.reactionArray.filter((r) => r.coefficient < 0);
|
|
347
|
+
}
|
|
348
|
+
getProducts() {
|
|
349
|
+
return this.reactionArray.filter((r) => r.coefficient > 0);
|
|
350
|
+
}
|
|
351
|
+
formatReactionPart(reactionPart) {
|
|
352
|
+
return reactionPart
|
|
353
|
+
.map((r) => {
|
|
354
|
+
const coefficient = Math.abs(r.coefficient) === 1 ? "" : Math.abs(r.coefficient);
|
|
355
|
+
return `${coefficient} ${r.species?.formula}`;
|
|
356
|
+
})
|
|
357
|
+
.join(" + ");
|
|
358
|
+
}
|
|
359
|
+
getReactionString() {
|
|
360
|
+
const reactants = this.getReactants();
|
|
361
|
+
const products = this.getProducts();
|
|
362
|
+
const reactantsString = this.formatReactionPart(reactants);
|
|
363
|
+
const productsString = this.formatReactionPart(products);
|
|
364
|
+
return `${reactantsString} \\rightarrow ${productsString}`;
|
|
365
|
+
}
|
|
366
|
+
getReactionWithoutCoef() {
|
|
367
|
+
const reactants = this.getReactants();
|
|
368
|
+
const products = this.getProducts();
|
|
369
|
+
const reactantsString = reactants
|
|
370
|
+
.map((r) => `? ${r.species?.formula}`)
|
|
371
|
+
.join(" + ");
|
|
372
|
+
const productsString = products
|
|
373
|
+
.map((r) => `? ${r.species?.formula}`)
|
|
374
|
+
.join(" + ");
|
|
375
|
+
return `$${reactantsString} \\rightarrow ${productsString}$`;
|
|
376
|
+
}
|
|
377
|
+
getReactionWithWrongCoef() {
|
|
378
|
+
const reactants = this.getReactants();
|
|
379
|
+
const products = this.getProducts();
|
|
380
|
+
const reactantsString = reactants
|
|
381
|
+
.map((r, index) => `${this.getRandomCoefficient()[index]} ${r.species?.formula}`)
|
|
382
|
+
.join(" + ");
|
|
383
|
+
const productsString = products
|
|
384
|
+
.map((r, index) => `${this.getRandomCoefficient()[index + reactants.length]} ${r.species?.formula}`)
|
|
385
|
+
.join(" + ");
|
|
386
|
+
return `${reactantsString} \\rightarrow ${productsString}`;
|
|
387
|
+
}
|
|
388
|
+
getRandomCoefficient(maxRange = 6) {
|
|
389
|
+
const myReactionCoef = this.reactionArray.map((species) => species.coefficient);
|
|
390
|
+
const randomCoefs = [];
|
|
391
|
+
let verif = true;
|
|
392
|
+
while (verif) {
|
|
393
|
+
for (let i = 0; i < myReactionCoef.length; i++) {
|
|
394
|
+
const randomCoef = Math.floor(Math.random() * maxRange) + 1;
|
|
395
|
+
randomCoefs.push(randomCoef === 1 ? "" : randomCoef);
|
|
396
|
+
}
|
|
397
|
+
for (let i = 0; i < myReactionCoef.length - 1; i++)
|
|
398
|
+
if (myReactionCoef[i] / randomCoefs[i] !==
|
|
399
|
+
myReactionCoef[i + 1] / randomCoefs[i + 1])
|
|
400
|
+
verif = false;
|
|
401
|
+
}
|
|
402
|
+
return randomCoefs;
|
|
403
|
+
}
|
|
404
|
+
getReactionWithQuestionMark(specieIndexWithQuestionMark) {
|
|
405
|
+
const reactants = this.getReactants();
|
|
406
|
+
const products = this.getProducts();
|
|
407
|
+
let reactantsString, productsString;
|
|
408
|
+
if (specieIndexWithQuestionMark >= reactants.length) {
|
|
409
|
+
reactantsString = this.formatReactionPart(reactants);
|
|
410
|
+
productsString = products
|
|
411
|
+
.map((r, index) => {
|
|
412
|
+
const coefficient = Math.abs(r.coefficient) === 1 ? "" : Math.abs(r.coefficient);
|
|
413
|
+
return index + reactants.length === specieIndexWithQuestionMark
|
|
414
|
+
? "\\ ?"
|
|
415
|
+
: `${coefficient} ${r.species?.formula}`;
|
|
416
|
+
})
|
|
417
|
+
.join(" + ");
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
reactantsString = reactants
|
|
421
|
+
.map((r, index) => {
|
|
422
|
+
const coefficient = Math.abs(r.coefficient) === 1 ? "" : Math.abs(r.coefficient);
|
|
423
|
+
return index === specieIndexWithQuestionMark
|
|
424
|
+
? "\\ ?"
|
|
425
|
+
: `${coefficient} ${r.species?.formula}`;
|
|
426
|
+
})
|
|
427
|
+
.join(" + ");
|
|
428
|
+
productsString = this.formatReactionPart(products);
|
|
429
|
+
}
|
|
430
|
+
return `$${reactantsString} \\rightarrow ${productsString}$`;
|
|
431
|
+
}
|
|
432
|
+
getUniqueAtomNames() {
|
|
433
|
+
const uniqueAtomNames = new Set();
|
|
434
|
+
for (const reactionSpecies of this.reactionArray) {
|
|
435
|
+
if (reactionSpecies.species) {
|
|
436
|
+
for (const atomData of reactionSpecies.species.atoms) {
|
|
437
|
+
uniqueAtomNames.add(atomData.atom.name);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return Array.from(uniqueAtomNames);
|
|
442
|
+
}
|
|
443
|
+
getSpeciesFormula() {
|
|
444
|
+
const speciesFormula = [];
|
|
445
|
+
for (const reactionSpecies of this.reactionArray) {
|
|
446
|
+
if (reactionSpecies.species) {
|
|
447
|
+
speciesFormula.push(reactionSpecies.species.formula);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return speciesFormula;
|
|
451
|
+
}
|
|
452
|
+
getSpeciesName() {
|
|
453
|
+
const speciesFormula = [];
|
|
454
|
+
for (const reactionSpecies of this.reactionArray) {
|
|
455
|
+
if (reactionSpecies.species) {
|
|
456
|
+
speciesFormula.push(reactionSpecies.species.name);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return speciesFormula;
|
|
460
|
+
}
|
|
461
|
+
getKeyIds() {
|
|
462
|
+
const speciesFormula = [];
|
|
463
|
+
for (const reactionSpecies of this.reactionArray) {
|
|
464
|
+
if (reactionSpecies.species) {
|
|
465
|
+
speciesFormula.push(reactionSpecies.species.keyId);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return speciesFormula;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
exports.Reaction = Reaction;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { ToTexOptions } from "../../tree/nodes/node";
|
|
2
|
+
import { Unit } from "../units/interfaces/unit";
|
|
2
3
|
export declare abstract class MeasureConstructor {
|
|
3
4
|
static random(): void;
|
|
4
5
|
}
|
|
5
|
-
export declare class Measure {
|
|
6
|
+
export declare class Measure<T extends string = string> {
|
|
6
7
|
exponent: number;
|
|
7
8
|
significantPart: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
unit?: Unit<T>;
|
|
10
|
+
constructor(value: number, exponent?: number, unit?: Unit<T>);
|
|
11
|
+
times(n: number | Measure<any>): Measure<T>;
|
|
12
|
+
divide(n: number | Measure<any>): Measure<T>;
|
|
13
|
+
add(n: number | Measure<T>): Measure<T>;
|
|
14
|
+
subtract(n: number | Measure<T>): Measure<T>;
|
|
11
15
|
toTex(opts?: ToTexOptions): string;
|
|
16
|
+
private toNotScientificTex;
|
|
12
17
|
/**
|
|
13
18
|
* n = nb decimals
|
|
14
19
|
*/
|
|
15
|
-
toSignificant(n: number): Measure
|
|
20
|
+
toSignificant(n: number): Measure<T>;
|
|
16
21
|
evaluate(): number;
|
|
17
|
-
equals(m: Measure): boolean;
|
|
22
|
+
equals(m: Measure<T>): boolean;
|
|
18
23
|
toIdentifiers(): {
|
|
19
24
|
significantPart: number;
|
|
20
25
|
exponent: number;
|
|
21
26
|
};
|
|
27
|
+
hasUnit(): boolean;
|
|
28
|
+
getUnit(): Unit<T>;
|
|
29
|
+
convert(unit: T): Measure<T>;
|
|
30
|
+
setUnit(unit: Unit<any>): void;
|
|
31
|
+
getValueAsNumber(): number;
|
|
22
32
|
}
|
|
23
33
|
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/pc/measure/measure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/pc/measure/measure.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAKrD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;CACd;AACD,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAEH,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAoD/D,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkB9B,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAgB/B,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuB1B,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuB/B,KAAK,CAAC,IAAI,CAAC,EAAE,YAAY;IA4BzB,OAAO,CAAC,kBAAkB;IAqB1B;;OAEG;IACH,aAAa,CAAC,CAAC,EAAE,MAAM;IAMvB,QAAQ;IAIR,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAMpB,aAAa;;;;IAOb,OAAO,IAAI,OAAO;IAIlB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC;IAOlB,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAW5B,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAIvB,gBAAgB,IAAI,MAAM;CAO3B"}
|