Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[toolbox] Add Faraday constant to math toolbox #2137

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ jobs:
- uses: msys2/setup-msys2@v2
with:
update: true
install: >-
git
mingw-w64-x86_64-arm-none-eabi-gcc
- uses: actions/checkout@v3
- run: build/setup.sh
- run: make PLATFORM=simulator ASSERTIONS=1 epsilon.exe
Expand Down
5 changes: 3 additions & 2 deletions apps/calculation/test/calculation_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,9 @@ QUIZ_CASE(calculation_additional_results) {
assertCalculationAdditionalResultTypeHas("√(-1)", {}, &globalContext, &store);
assertCalculationAdditionalResultTypeHas("{1}", {}, &globalContext, &store);
assertCalculationAdditionalResultTypeHas("{i}", {}, &globalContext, &store);
assertCalculationAdditionalResultTypeHas("i^(2×e^(7i^(2×e^322)))", {},
&globalContext, &store);
/* TODO: Not working on windows
* assertCalculationAdditionalResultTypeHas("i^(2×e^(7i^(2×e^322)))", {},
* &globalContext, &store);*/

assertCalculationAdditionalResultTypeHas("ln(3+4)", {}, &globalContext,
&store);
Expand Down
4 changes: 2 additions & 2 deletions apps/inference/models/statistic/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ bool Test::computeCurveViewRange(float transition, bool zoomSide) {
if (zoomSide) {
alpha = thresholdAbscissa(
Poincare::ComparisonNode::OperatorType::Superior, 0.5);
z = abs(z);
z = std::abs(z);
} else {
alpha = thresholdAbscissa(
Poincare::ComparisonNode::OperatorType::Inferior, 0.5);
z = -abs(z);
z = -std::abs(z);
}
} else {
alpha = thresholdAbscissa(hypothesisParams()->comparisonOperator());
Expand Down
2 changes: 1 addition & 1 deletion apps/shared/continuous_function_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ void ContinuousFunctionProperties::setPolarFunctionProperties(
Trigonometry::DetectLinearPatternOfCosOrSin(
denominator, reductionContext, Function::k_unknownName, false,
nullptr, &coefficientBeforeTheta, &angle) &&
abs(coefficientBeforeTheta) == 1.0) {
std::abs(coefficientBeforeTheta) == 1.0) {
double positiveAngle = std::fabs(angle);
if (positiveAngle == 0.0 || positiveAngle == M_PI) {
setCaption(I18n::Message::PolarVerticalLineType);
Expand Down
2 changes: 2 additions & 0 deletions apps/shared/math_toolbox_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ constexpr ToolboxMessageTree ConstantsChildren[] = {
I18n::Message::SpeedOfLight),
ToolboxMessageTree::Leaf(I18n::Message::ElementaryChargeSymbol,
I18n::Message::ElementaryCharge),
ToolboxMessageTree::Leaf(I18n::Message::FaradaySymbol,
I18n::Message::FaradayConstant),
ToolboxMessageTree::Leaf(I18n::Message::GravitationalConstantSymbol,
I18n::Message::GravitationalConstant),
ToolboxMessageTree::Leaf(I18n::Message::AccelerationOfGravitySymbol,
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.de.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Einheiten Umrechnung von a in b"
Constants = "Konstanten"
SpeedOfLight = "Lichtgeschwindigkeit"
ElementaryCharge = "Elementarladung"
FaradayConstant = "Faraday-Konstante"
GravitationalConstant = "Gravitationskonstante"
AccelerationOfGravity = "Fallbeschleunigung"
BoltzmannConstant = "Boltzmann-Konstante"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.en.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Manual conversion from unit a to b"
Constants = "Constants"
SpeedOfLight = "Speed of light in a vacuum"
ElementaryCharge = "Elementary charge"
FaradayConstant = "Faraday constant"
GravitationalConstant = "Gravitational constant"
AccelerationOfGravity = "Acceleration of gravity"
BoltzmannConstant = "Boltzmann constant"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.es.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Conversión manual de a en b"
Constants = "Constantes"
SpeedOfLight = "Velocidad de la luz"
ElementaryCharge = "Carga eléctrica elemental"
FaradayConstant = "Constante de Faraday"
GravitationalConstant = "Constante de gravitación universal"
AccelerationOfGravity = "Aceleración de la gravedad"
BoltzmannConstant = "Constante de Boltzmann"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.fr.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Conversion manuelle de a en b"
Constants = "Constantes"
SpeedOfLight = "Vitesse de la lumière dans le vide"
ElementaryCharge = "Charge élémentaire"
FaradayConstant = "Constante de Faraday"
GravitationalConstant = "Constante gravitationnelle"
AccelerationOfGravity = "Accélération de la pesanteur"
BoltzmannConstant = "Constante de Boltzmann"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.it.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Conversione manuale da a a b"
Constants = "Costanti"
SpeedOfLight = "Velocità della luce"
ElementaryCharge = "Carica elementare"
FaradayConstant = "Costante di Faraday"
GravitationalConstant = "Costante gravitazionale"
AccelerationOfGravity = "Accelerazione di gravità"
BoltzmannConstant = "Costante di Boltzman"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.nl.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Handmatige conversie van eenheden"
Constants = "Constanten"
SpeedOfLight = "Lichtsnelheid in een vacuüm"
ElementaryCharge = "Elementaire lading"
FaradayConstant = "Faradayconstante"
GravitationalConstant = "Gravitatieconstante"
AccelerationOfGravity = "Valversnelling"
BoltzmannConstant = "Constante van Boltzmann"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.pt.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ UnitConversion = "Conversão manual de unidades"
Constants = "Constantes"
SpeedOfLight = "Velocidade da luz no vazio"
ElementaryCharge = "Carga elementar"
FaradayConstant = "Constante de Faraday"
GravitationalConstant = "Constante de gravitação universal"
AccelerationOfGravity = "Aceleração da gravidade"
BoltzmannConstant = "Constante de Boltzmann"
Expand Down
1 change: 1 addition & 0 deletions apps/toolbox.universal.i18n
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ UnitMagneticFieldTesla = "Tesla"
UnitInductanceHenry = "Henry"
SpeedOfLightSymbol = "_c"
ElementaryChargeSymbol = "_e"
FaradaySymbol = "_F"
GravitationalConstantSymbol = "_G"
AccelerationOfGravitySymbol = "_g0"
BoltzmannConstantSymbol = "_k"
Expand Down
2 changes: 1 addition & 1 deletion build/config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PLATFORM ?= device
DEBUG ?= 0
DEVELOPMENT ?= 0

EPSILON_VERSION ?= 22.1.0
EPSILON_VERSION ?= 22.2.0
EXTERNAL_APPS_API_LEVEL ?= 0
EPSILON_APPS ?= calculation graph code statistics distributions inference solver sequence regression elements finance settings
EPSILON_I18N ?= en fr nl pt it de es
Expand Down
2 changes: 1 addition & 1 deletion ion/src/device/epsilon-core
2 changes: 1 addition & 1 deletion ion/src/simulator/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ android {
res.srcDir BUILD_DIR + '/res'
java.srcDir 'src'
jniLibs.srcDir BUILD_DIR + '/libs/' + System.getenv('EPSILON_VARIANT')
assets.srcDirs = ['../assets', EPSILON_BUILD_DIR + 'ion/src/simulator/assets']
assets.srcDirs = ['../assets', EPSILON_BUILD_DIR + '/ion/src/simulator/assets']
}
}
lintOptions {
Expand Down
2 changes: 1 addition & 1 deletion kandinsky/src/context_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void KDContext::drawAntialiasedLine(float x1, float y1, float x2, float y2,
/* Implements Xiaolin Wu's line algorithm
* https://en.wikipedia.org/wiki/Xiaolin_Wu%27s_line_algorithm */

bool steep = abs(y2 - y1) > abs(x2 - x1);
bool steep = std::fabs(y2 - y1) > std::fabs(x2 - x1);
if (steep) {
std::swap(x1, y1);
std::swap(x2, y2);
Expand Down
1 change: 1 addition & 0 deletions poincare/include/poincare/constant.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class ConstantNode final : public ExpressionNode {
ConstantInfo{k_exponentialEName, 2, M_E, nullptr},
ConstantInfo{"_c", 3, 299792458.0, "_m/_s"},
ConstantInfo{"_e", 3, 1.602176634e-19, "_C"},
ConstantInfo{"_F", 3, 96485.3321233, "_C*_mol^-1"},
ConstantInfo{"_G", 3, 6.67430e-11, "_m^3*_kg^-1*_s^-2"},
ConstantInfo{"_g0", 3, 9.80665, "_m/_s^2"},
ConstantInfo{"_k", 3, 1.380649e-23, "_J/_K"},
Expand Down
6 changes: 6 additions & 0 deletions python/port/mod/ion/modion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ mp_obj_t modion_keyboard_keydown(mp_obj_t key_o) {
if (key >= Ion::Keyboard::Key::None) {
return mp_obj_new_bool(false);
}
/* In version 22, scan was greatly sped up. We wait 1 ms after the scan to
* keep the keydown function consistent with older versions.
* WARNING: Do not use Timing::msleep to avoid putting the device to sleep,
* which alters timings (mostly on N120) */
uint64_t currentTime = Ion::Timing::millis();
Ion::Keyboard::State state = Ion::Keyboard::scan();
while (currentTime + 1 > Ion::Timing::millis()) {}
micropython_port_interrupt_if_needed();
return mp_obj_new_bool(state.keyDown(key));
}