Commit Graph

75 Commits

Author SHA1 Message Date
Hugo Saint-Vignes
a5a57c4076 [poincare] Improve prefixes for mass and inductance unities
Change-Id: Ic9eb7b5adff7b172452b4c73bd7ddc5c59761219
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
11e41bb4dc [poincare] Add comments and alternative algorithm to beautify units
Change-Id: I4b1ce9528d9d6796fe08f8566ee5d1efafa1d87d
2020-11-04 14:45:35 +01:00
Hugo Saint-Vignes
51f1cdb076 [poincare] Handle rational unit exponents
Change-Id: Id710702dbed19d34992da90978d5823d68abb80a
2020-11-04 14:45:35 +01:00
Gabriel Ozouf
6f378ef3ef [poincare] Implemented didDerivate for Multiplication
Derivation propagates as expected on multiplications (but not power). Some tests involving diff had to be updated to reflect that behaviour.

Change-Id: Ifa32031bc37a156c18d296757bcdd6ccdb0ea43e
2020-11-04 14:45:34 +01:00
Léa Saviot
3a046f5bcb [poincare/multiplication] Fix Multiplication::removeUnit
Scenario:
f(x) = 0->_A
evaluate 0f(0)
2020-07-16 11:46:23 +02:00
Léa Saviot
36bc70aaee [poincare/power] Better Power::shallowReduce
Take care of an undefined index that arrived during the remove unit
2020-07-16 11:46:23 +02:00
Léa Saviot
9e94304db0 [poincre/test] Rename assert_simplify -> assert_reduce
And assert_expression_simplify -> assert_expression_reduce
2020-07-16 11:46:23 +02:00
Léa Saviot
43744bcae9 [poincare/power] Fix shallowReduce
Scenario: f(x) = 0->0
In graph, go to x = e^(f(0))
2020-07-15 13:07:17 +02:00
Émilie Feral
ad86378a5c [poincare] Unit: -_m should be beautified to -1x_m 2020-06-11 12:02:17 +02:00
Émilie Feral
4b83da21b7 [poincare] Fix Multiplication between 0 and a unreduced matrix: it
should not be equal to 0 but to Matrix(0)
2020-06-04 14:50:10 +02:00
Léa Saviot
a9fbcf99b2 [poincare/test] Add failing test about multiplication simplification
The result should be 0*[[1,0][0,1]]^500, or, maybe later, [[0,0][0,0]]
2020-06-04 14:50:10 +02:00
Léa Saviot
55ae258653 [poincare/test] Add failing matrix/power simplification test 2020-06-04 14:50:10 +02:00
Émilie Feral
a48f65ba95 [poincare] Unit: ensure one unique instance of each prefix 2020-06-04 14:50:07 +02:00
Émilie Feral
53db27ffeb [poincare] Discard UnitConversion::Classic mode. This will be done in
Calculation app
2020-06-04 14:50:03 +02:00
Émilie Feral
4d7b9aa2a9 [poincare] Add watthour representation to classic unit conversion 2020-06-04 14:50:02 +02:00
Émilie Feral
cc114900fa [poincare] Add Liter representation to classic unit conversion 2020-06-04 14:50:02 +02:00
Émilie Feral
e2dc79c2d5 [poincare] Partially implement simplification for UnitConversion::Classic 2020-06-04 14:50:02 +02:00
Émilie Feral
c3e68d1968 [poincare] Add test on the UnitConversion mode 2020-06-04 14:50:01 +02:00
Émilie Feral
4e2da5de05 [poincare] Add crashing tests on units 2020-06-04 14:50:01 +02:00
Émilie Feral
56c45d1390 [poincare] Parsing: expression -> expression is always parsed but return
"undef" when the left expression is neither a custom variable or
function nor a unit.
This makes the behaviour consistent on theses expressions:
2 -> a+a
2 -> 2*a
2020-06-04 14:50:01 +02:00
Ruben Dashyan
bf9653d510 [poincare/expression] Turn getUnit into extractUnits
Addition::shallowReduce factors the unit across its terms.
Previously expressions of the form 1_m+π_m were reduced to undef.
2020-06-04 14:50:01 +02:00
Ruben Dashyan
94e1fdfc7a [poincare/test/simplification] Uncomment passing tests 2020-06-04 14:50:01 +02:00
Émilie Feral
8c844a772b [poincare] Fix tests to be passed on windows platform (approximation
issues)
2020-04-10 13:34:00 -04: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
Émilie Feral
12a5f5499c [poincare] Handle real root finding in Power and NthRoot in order to
remove beautifying x^(p/q) -> root(x,q)^p. This triggered precision
loss!
2020-03-12 14:41:50 +01:00
Léa Saviot
a06660ee25 [poincare/vert_off_lay] Subscript layout serializes without _
This way there is no parsing confusion when copy pasting the subscript of
a subscript layout
2020-03-02 09:55:11 +01:00
Émilie Feral
a211b6efb6 [poincare] Change unit name: hour -> h 2020-02-12 15:13:25 +01:00
Ruben Dashyan
ca50e764a5 [poincare/test] Test the presence of units as Expression children 2020-02-12 15:13:25 +01:00
Léa Saviot
c124447837 [poincare/test] Add test on UnitConvert simplification 2020-02-12 15:13:25 +01:00
Léa Saviot
b2a37cfd3e [poincare] Fix tests 2020-02-12 15:13:25 +01:00
Ruben Dashyan
681ab5429a [poincare/test/simplification] Fix typos 2020-02-12 15:13:25 +01:00
Léa Saviot
23e8033a3e [poincare/test] Add tests on unit convert simplification 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
Léa Saviot
b93277bb7b [poincare/test] Fix tests
Unparsable tests are now parsable but return undef at the simplification
2020-02-12 15:13:25 +01:00
Ruben Dashyan
3aea607be2 [poincare] Force Float(1) in front of an orphan (Power of) Unit 2020-02-12 15:13:25 +01:00
Ruben Dashyan
d8e36e3cf1 [poincare/test/simplification] Fix units' tests 2020-02-12 15:13:25 +01:00
Ruben Dashyan
907bd0db62 [poincare/test/simplification] Fix typo 2020-02-12 15:13:25 +01:00
Ruben Dashyan
30fb27d36a [poincare/test/simplification] Add tests on Units 2020-02-12 15:13:25 +01:00
Léa Saviot
8a0e5403ae [poincare/test] Add unit conversion tests 2020-02-12 15:13:24 +01:00
Émilie Feral
ff438cbea8 [poincare] Multiplication::shallowReduce: don't apply 0*a --> 0 when a
involves unit or infinity
2020-02-12 15:13:24 +01:00
Émilie Feral
ee1224dd95 [poincare] Multiplication::shallowBeautify: Keep the unit when the value
is 0 or undefined, add tests
2020-02-12 15:13:24 +01:00
Ruben Dashyan
a13ce5df49 [poincare/test/simplification] Test simplification of units 2020-02-12 15:13:24 +01:00
Léa Saviot
470b713226 [test] Fix tests for new SymbolicComputation parameter 2020-02-12 15:13:24 +01:00
Ruben Dashyan
4d7c12987d [poincare/test/simplification] Gather hyperbolic trigonometry tests 2020-02-12 15:13:23 +01:00
Émilie Feral
855cec527f [poincare] Power: remove rule i^(p/q) -> e^(i*Pi*p/2q).
This is handles in ComplexCartesian class when the simplification target
is the user and it doesn't need to be handled for other simplification
targets (we even prefer the first form).
2020-02-12 15:13:23 +01:00
Émilie Feral
1f02e8e381 [poincare] AbsoluteValue: add rule |x*y| --> |x|*|y| and |x^y| --> |x|^y 2020-02-12 15:13:23 +01:00
Émilie Feral
4e948ce533 [poincare] Change Factor approximation to return undef on non real
values
2020-02-12 15:13:22 +01:00
Léa Saviot
167fdf285f [poincare/test] Simplification test on f(1/0) when f(x) = 3 2020-02-12 15:13:21 +01:00
Léa Saviot
78adca7113 [poincare/tests] Fix tests after parsing change 2020-02-12 15:13:21 +01:00
Émilie Feral
280f20c93c [poincare] Fix remainder of division by 0: rem(12,0) should be undefined
and not infinity
2020-02-12 15:13:19 +01:00