Commit Graph

62 Commits

Author SHA1 Message Date
É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
Émilie Feral
30c4e01737 [poincare] Fix and add tests about BasedInteger 2020-02-12 15:13:19 +01:00
Ruben Dashyan
ab80741838 [poincare/test/simplification] Remove redundant tests 2020-02-12 15:13:16 +01:00
Ruben Dashyan
3271fc90a4 [poincare/test] Clean header inclusions 2020-02-12 15:13:16 +01:00
Émilie Feral
984d1ff924 [poincare] Expression::CreateComplexExpression: fix crash when creating
Polar form
2019-11-26 10:36:42 +01:00
Émilie Feral
ccf848a9eb [poincare] Add test: do not expand multinome when reduction target is
System
2019-11-21 09:47:16 +01:00
Émilie Feral
6135fced52 [poincare] Power: always reduce (a^b)^(-1) 2019-11-13 15:54:46 +01:00
Émilie Feral
0736a3f55a [poincare] In Polar complex format, avoid displaying real expression as
sqrt of square when possible
2019-11-05 16:46:21 +01:00
Émilie Feral
e8046ddb9a [poincare] Trigonometry: fix shallowReduceDirectFunction 2019-11-05 16:46:21 +01:00
Émilie Feral
d95e25c4b7 [poincare] Power::shallowReduce: reducing should happen after replacing
the expression in its hierarchical context

Fix sum(1/n, n, 1, 5) reducing with no symbolic computation
2019-09-20 17:31:51 +02:00
Émilie Feral
3831c66183 [poincare] Randint: fix approximation to return undef when the result is
going to lack precision
2019-09-20 17:11:56 +02:00
Léa Saviot
3911dc89b7 [poincare/normcdf2] Fix shallowReduce (mu and var indexes were wrong) 2019-09-19 14:28:40 +02:00
Émilie Feral
f995cd3a90 [poincare] Fix tests: different libm have various precisions on trigonometric function
(tan(pi/2) is not always undef). Change approximation tests to be
correct on travis platform.
2019-09-18 15:24:51 +02:00
Émilie Feral
c5ed1bebfe [poincare] HyperbolicTrigonometricFunction: add rules cosh(0) -> 1,
sinh(0) -> 0, tanh(0) -> 0 and acosh(1) -> 0, asinh(0) -> 0, atanh(0) ->
0
2019-08-29 10:01:40 +02:00