Commit Graph

423 Commits

Author SHA1 Message Date
Yaya-Cout
73450419bb [Ports] Merge Nspire port and Fxcg improvements
Close #327
2023-06-06 21:28:54 +02:00
Yaya-Cout
169fb7404e Fix spelling (#128)
* Fix spelling in .cpp files

* Fix spelling in all files
2022-01-20 17:21:35 +01:00
Émilie Feral
e8887a4e70 [poincare] Remove unused variable 2021-01-06 16:30:07 +01:00
Hugo Saint-Vignes
e09bd0a18c [poincare] Factorize reduce and removeUnit methods 2020-12-22 17:32:40 +01:00
Gabriel Ozouf
efbbbe94ff [poincare/expression] Comment and variable names 2020-12-14 10:20:09 +01:00
Gabriel Ozouf
c7b758f536 [poincare/expression] Fix solutions to e^x=0
Because of the limitations of the floating-point representation, e^x is
null for x <= 710, causing the nextRoot functions to find roots for it.
To prevent this, we looking for places where a function changes sign, we
actually require the function to take two non-null values of different
signs.
2020-12-14 10:20:09 +01:00
Léa Saviot
5df60e946a [poincare] shallowBeautify can modify the reduction context
UnitConvert must set UnitConversion to None, otherwise the unit asked
for in the conversion might get changed after being properly set in
UnitConvert::shallowBeautify.
2020-11-09 15:50:27 +01:00
Émilie Feral
7142f9545e [poincare] Finish replacing approximateContext 2020-11-04 15:58:41 +01:00
Émilie Feral
75dc415e27 [poincare] Step I: add a parameter to approximation routines to indicate
if we're within a reduction routine
2020-11-04 15:58:40 +01:00
Hugo Saint-Vignes
58114255e5 [poincare] implement isRationalZero for other numbers
Change-Id: I40f61958f9e51adb376407b2a512097962979417
2020-11-04 15:58:33 +01:00
Hugo Saint-Vignes
073893ae48 [poincare] Exact undef results with GCD and LCM
Change-Id: Iba39cd6140d8ef5b3fd24e0f53c9e28fbd57d438
2020-11-04 15:33:01 +01:00
Gabriel Ozouf
fad375c11c [poincare] Add unitFormat to ReductionContext
Change-Id: I1d3fcd2f47c973c041e1be84e9a902dd58de3562
2020-11-04 15:11:44 +01:00
Hugo Saint-Vignes
6db02ea122 [poincare/vectors] Implement Vectors operations
Change-Id: Ib5aa2f5951f4eabe3b04078eab8b7d3a4d3769e7
2020-11-04 15:11:43 +01:00
Gabriel Ozouf
891366c51d [poincare/expression_node] Added Double type
Float<float> and Float<double> used to share the same expression type
(Float), and the distinction was made by comparing their size. However,
due to padding, their size could be the same, leading to some issues :
  - On the simulator, in Calculation, type 1_mm^3 and go to the
    additional outputs. One of the results would be -0.0003081979_µm^3.

Change-Id: Ic8f9328bf462104776fbab636c34d0d152cd7e58
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
3bfc0c83d8 [poincare] Factorize Echelon Form classes
Change-Id: I7ec7290a4d94b9bd1224ad4c53be8b4662bd32d5
2020-11-04 15:07:20 +01:00
Hugo Saint-Vignes
007c38652f [poincare] Add ref and rref matrix functions
Change-Id: Id0e57a4f85d551ca5320c4b6e3c0baadae70946d
2020-11-04 15:07:20 +01:00
Léa Saviot
f3628f368f [poincare/expression] Return undef if simplification interrupted
Without this change, we would get weird "reduced" expression, such as
multiplication(undef, _s), but we do not always check
sSimplificationHasBeenInterrupted afterwards.
2020-07-29 10:13:19 +02:00
Léa Saviot
c20261940f [poincare] Handle removeUnit that create Undefined expressions
UnitConvert::removeUnit replaces the unit ocnvert with an undefined.
2020-07-16 11:46:23 +02:00
Léa Saviot
cf4eaa3d1f [apps/poincare] Use symbolicComputation in recursivelyMatches
This fixes a failed assertion for the scenario:
[3]->x then, in the Equation app, solve x+1->0
2020-06-15 16:20:09 +02:00
Émilie Feral
d21c9b0880 [poincare] Expression: clean magic numbers 2020-06-12 13:49:32 +02:00
Émilie Feral
3308b13b9c [poincare] UnitConvert:
- do the smart part at beautification to avoid
requiring an escape case just for UnitConvert
- Use UnitConvert::None
2020-06-04 14:50:01 +02:00
Émilie Feral
3f34e5e644 [poincare] Enable to choose the "UnitConversion" mode at simplification
between: only SI, none, default...
2020-06-04 14:50:01 +02:00
Émilie Feral
d805c59202 [poincare] Fix extractUnit into removeUnit paradigm 2020-06-04 14:50:01 +02:00
Ruben Dashyan
407ce0534c [poincare/expression] Use extractUnits instead of hasUnit when possible 2020-06-04 14:50:01 +02:00
Ruben Dashyan
651b705dbd Revert "[poincare/expression] deepBeautify bubbles up Undefined children"
This reverts commit 300399fe4d.

Not necessary anymore to bubble up Undefined children in deepBeautify
since Unit::shallowBeautify does not introduce any Undefined Expression.
2020-06-04 14:50:01 +02:00
Ruben Dashyan
b8993eafa9 [poincare/expression] Call reduce instead of deepReduce 2020-06-04 14:50:01 +02:00
Léa Saviot
9988447b9a [poincare] Expression::isIdenticalToWithoutParentheses 2020-04-15 09:16:32 -04:00
Léa Saviot
94fb5815f9 [poincare] Fix replaceReplaceableSymbols for parametered expressions
Scenario: ans*int(0,x,0,0)->x then cos(x) crashed because replaceReplaceableSymbols
would not care if it was replacing parameters in a parametered
expression
2020-03-31 13:42:42 +02:00
Émilie Feral
7c79c70890 [poincare] When simplification has been interrupted, escape the end of
simplification. Otherwise we can be stuck in infinite loop.

This fixes the following bug: when simplifying an expression as
'bigRational1^x*bigRational2^x', we use the rule a^x*b^x --> (a¨b)^x. However,
in this case, a*b can't be reduce (resulting rational would be too big) and
we're stuck in the loop a^x*b^x --> (a¨b)^x --> a^x*b^x --> (a¨b)^x...
2020-03-24 16:22:43 +01:00
Léa Saviot
1dc6e77049 [poincare/matrix] Forbid nested matrices
Scenario: in calculation,
1/matrix(matrix(matrix(matrix(... matrix(1) ... )))) gave kind of a
weird result. These kind of computations also broke the fuzzer.
2020-03-04 16:21:25 +01:00
Ruben Dashyan
a72e4d43ae [poincare/expression] Short-circuit brentMinimum and brentRoot 2020-02-28 18:08:01 +01:00
Ruben Dashyan
9a79081b47 [poincare/expression] Fix typo in nextIntersection
The approximative solution should be rounded up to zero if it is
dominated by the solver's precision.
2020-02-28 18:08:01 +01:00
Léa Saviot
4d8099e273 [poincare/matrix] shallowReduce checks there are no unit children 2020-02-12 15:13:26 +01:00
Ruben Dashyan
b5233845ba [poincare/expression] Fix Unit approximation in beautifyAndApproximateScalar
A Unit is considered as real, which was not the case before.
2020-02-12 15:13:25 +01:00
Léa Saviot
2e5df5196f [poincare/expression] hasUnits makes less computations 2020-02-12 15:13:25 +01:00
Léa Saviot
1588f81bea [poincare/power] Fix shallowReduce with units
(3_m^2)^3 should be reduced to 3_m^6
2020-02-12 15:13:25 +01:00
Ruben Dashyan
cc280373d0 [poincare] Reducing an Expression which hasUnit in its children returns Undefined in general 2020-02-12 15:13:25 +01:00
Léa Saviot
d5b07f1f90 [poincare] Implemment getUnit 2020-02-12 15:13:25 +01:00
Léa Saviot
ecdcb100fb [poincare/unit_convert] Fix UnitConvert::shallowReduce 2020-02-12 15:13:25 +01:00
Léa Saviot
4651f7ef0d [poincare/expression] Fix simplifyAndApproximate with convertUnit 2020-02-12 15:13:24 +01:00
Léa Saviot
c543985094 [poincare] Unit conversion 2020-02-12 15:13:24 +01:00
Léa Saviot
424ee9fa15 [poincare] Add SymbolicComputation parameter to the reduction context
This way, in solver, we can reduce expression without expanding symbols
2020-02-12 15:13:24 +01:00
Léa Saviot
0e64e89496 [apps/solver] Do not use symbol context if no solution found
Still replace the functions
2020-02-12 15:13:23 +01:00
Ruben Dashyan
f9e419dcd6 [poincare/expression] defaultDeepReduceChildren does not recompute the number of children 2020-02-12 15:13:23 +01:00
Émilie Feral
551e4998f4 [apps/calculation][apps/solver][poincare] Simplify sign =/≈ computation
between outputs in Calculation/Solver
2020-02-12 15:13:23 +01:00
Ruben Dashyan
054aac2c1c [poincare/expression] Equalize simplified and approximate output in presence of units 2020-02-12 15:13:23 +01:00
Émilie Feral
4b98652ed9 [poincare] Parser: Context is now a member variable of the Parser class
instead of being given as a parameter in all methods
2020-02-12 15:13:23 +01:00
Ruben Dashyan
300399fe4d [poincare/expression] deepBeautify bubbles up Undefined children 2020-02-12 15:13:22 +01:00
Léa Saviot
756eeeb2d8 [poincare/parser] Add context 2020-02-12 15:13:21 +01:00
Émilie Feral
398b529811 [apps/calculation][poincare] AdditionalInformationType is determined
from both input and output expressions of a Calculation
2020-02-12 15:13:21 +01:00