Commit Graph

398 Commits

Author SHA1 Message Date
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
Émilie Feral
f6dcc35bce [poincare] Standardize the convention of 'deepReplaceReplaceableSymbols'
and 'ExpressionWithoutSymbols': they return an uninitialized expression
when the expression is circularly defined
2020-02-12 15:13:21 +01:00
Émilie Feral
2b18f585d0 [poincare] additionalInformationType returns "Complex" only when both
real and imaginary parts are defined (not NAN or INFINITY)
2020-02-12 15:13:21 +01:00
Émilie Feral
0ec3675b76 [poincare] Fix AdditionalInformationType: fix typo 2020-02-12 15:13:20 +01:00
Émilie Feral
e324c1af10 [poincare] AdditionalInformationType: integer above 1E16 don't have
additioncal informations
2020-02-12 15:13:20 +01:00
Émilie Feral
6af04edf32 [poincare] Expression::additionalInformationType: return Rational for
all forms of type [±12]/[±32]
2020-02-12 15:13:19 +01:00
Émilie Feral
1f3dc95a0f [poincare] Fix AdditionalInformation on Integer and Rational 2020-02-12 15:13:19 +01:00
Émilie Feral
a21689d72c [apps/calculation][poincare] Move additionalInformationType method from
Calculation to Poincare module
2020-02-12 15:13:18 +01:00
Ruben Dashyan
5d1cc521f4 [poincare/expression] Mark nbChildren variable as const in deepBeautify 2020-02-12 15:13:16 +01:00
Ruben Dashyan
dd80be026d [poincare] Rename shallowReplaceReplaceableSymbols to deep... 2020-02-12 15:13:15 +01:00
Ruben Dashyan
47ed5814a2 [poincare] Remove hasReplaceableSymbols 2020-02-12 15:13:15 +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
Romain Goyet
a34ecd2769 [poincare] Use std::move when needed
When returning a subclass of an Expression as an Expression, make sure
to use std::move, otherwise the compiler cannot proceeed to copy
ellision.
2019-10-16 10:01:14 +02:00
Ruben Dashyan
1868e47b19 [poincare/expression] Assert defautReplaceSymbolWithExpression does not alter the number of children 2019-09-27 17:57:29 +02:00
Ruben Dashyan
77860aeee9 [poincare] Remove replaceUnknown
Unused anymore
2019-09-27 17:57:29 +02:00
Ruben Dashyan
d506bb4442 [poincare] Remove Expression::defaultReplaceUnknown
and substitute defaultReplaceSymbolWithExpression instead
2019-09-27 17:57:29 +02:00
Ruben Dashyan
7d5f9d0aca [poincare] Factor asserts in Expression::replaceUnknown 2019-09-27 17:57:29 +02:00
Ruben Dashyan
76e0f78c53 [poincare/expression] Replacing a symbol does not alter in this case the number of children 2019-09-27 17:57:29 +02:00
Léa Saviot
c05bcf04d7 [poincare/expression] Fix coding typo 2019-09-20 10:20:48 +02:00
Léa Saviot
7527f828ea [poincare/expression] Coding style 2019-09-20 10:20:48 +02:00
Léa Saviot
93832549f1 [poincare] childNeedsUserParentheses takes childIndex param
Scenario:
0+exp^0 i->b
0+exp b^0 i->b
Go to VariableBox/expression -> Parentheses were not properly added when
b was replaced
2019-09-20 10:20:48 +02:00
Léa Saviot
e09e36a57f [poincare] When replacing symbols, if it contains itsef return undef
Circularly defined functions/symbols are detected more quickly, which
prevents some tree pool exhaustions.
For instance, with f(t) = [[f(t)][f(2t)]]
2019-09-12 11:04:12 +02:00
Léa Saviot
d9f650d283 [ion/utf8_helper] HasCodePoint 2019-09-09 13:30:04 +02:00
Léa Saviot
c71ef7ff79 [apps/graph] Evaluation methods renaming 2019-08-29 11:07:22 +02:00
Léa Saviot
7ea7ecd3c2 [poincare/coordinate2D] Rename member values to x and y 2019-08-29 11:07:22 +02:00