Commit Graph

2847 Commits

Author SHA1 Message Date
Émilie Feral
3c3f68c6c4 [poincare] Multiplication and Division implement realPart,
imaginaryPart and complexNorm
2019-01-10 11:42:03 +01:00
Émilie Feral
d95585956c [poincare] Implement Expression::realPart, Expression::imaginaryPart,
Expression::complexNorm, Expression::complexArgument
2019-01-10 11:42:03 +01:00
Émilie Feral
0e1825817b [poincare] Test: clean helper
Create a method expressions_are_equal
2019-01-10 11:42:02 +01:00
Émilie Feral
0c1e76c9c5 [poincare] Expression: add methods to get complex parts of expression 2019-01-10 11:42:02 +01:00
Émilie Feral
f8f3652687 [poincare] Expression: add radianToDegree and degreeToRadian methods 2019-01-10 11:42:02 +01:00
Émilie Feral
88a2751e6b [poincare] Add SignFunction class 2019-01-10 11:42:02 +01:00
Émilie Feral
c4ce3c28e1 [poincare] Factorial::sign is always positive 2019-01-10 11:42:02 +01:00
Léa Saviot
8c6ffa6d42 [apps] Fix graph X axis labels that read the same
Scenario: just zoom in in a graph
Fix:
- Do not truncate labels.
- Label size is computed depending on available size and number of
 labels.
- If labels cannot be displayed properly, just display the minimal
and maximal labels!
2019-01-10 11:42:02 +01:00
Léa Saviot
86409c771a [poincare/expression] Add escape case on uninitialized expression 2019-01-10 11:42:02 +01:00
Léa Saviot
f62249c8ac [poincare] Try to reduce the number of digits in print float
We did not take into account the zeros ending the mantissa when
computing a smaller required length.
2019-01-10 11:42:02 +01:00
Léa Saviot
78c277b159 Fix comment typo 2019-01-10 11:42:02 +01:00
Léa Saviot
f470a99081 [poincare] Multiplications are collapsed in fractions
For instance, typing 3*2 the '/' creates the fraction (3*2)/
Before, it would only divide the '2'
2019-01-10 11:42:02 +01:00
Léa Saviot
f6a5759a16 [poincare] Fix the replacement of unknowns in the storage
In the Graph app, define f(x) = cos(x) and g(x)=diff(f(x),x,x).
The graph and table are perfectly computed, but in the Calculation apps,
g(5) fails.
2018-12-19 09:40:37 +01:00
Émilie Feral
ec08f027c0 [poincare] Revert: Use Simplify instead of Reduce II
To approximate an expression, it is more precise to
approximate its simplified form than its reduced form. Indeed, we want
to minimize the number of nodes in the expression before approximating.
For instance, a/b has fewer nodes than a*b^-1.
2018-12-18 10:46:20 +01:00
Émilie Feral
9a254eb78b [poincare] Fix Integer approximation
Take into accound the sign even if the approximation is infinite
2018-12-18 09:34:15 +01:00
Émilie Feral
90fa6f0850 [poincare] Fix Integer::approximate
Take the sign into account even for infinite values
2018-12-17 17:04:31 +01:00
Émilie Feral
bc1a1c25d2 [poincare] Fix precision of approximation of arc trigonomtry when the
result is in real numbers
2018-12-17 09:47:25 +01:00
Émilie Feral
06264b2ea8 [poincare] Fix sqrt(-1) reduces to i 2018-12-17 09:43:06 +01:00
Émilie Feral
aa0b785f3d [shared] In models Equation, Sequence: the recorded expression does not
need to be beautified. Use Reduce instead of simplify
2018-12-17 09:41:14 +01:00
Émilie Feral
beab798a14 [poincare] Power: fix approximation precision
std::pow is more precise on doubles than on complexes, we rather use the
double version when possible
2018-12-14 12:17:36 +01:00
Émilie Feral
3cb765c66d [poincare] Power approximation: fix 0^0 = NAN instead of 0^0=1 2018-12-11 14:34:01 +01:00
Émilie Feral
2d97b43e63 [poincare] Fix Power::compute precision on real numbers
Fix bug: if we define f(x) = x^3-x-6, f(2) was not equal to 0 in the
values table
2018-12-06 15:13:36 +01:00
Léa Saviot
f84d56a5c9 [poincare] Reset interruption flag before evaluation 2018-12-03 12:32:05 +00:00
Émilie Feral
58eab04c5f [poincare] Expression: add an argument to reduce routine.
Reduction can be done for:
- the user
- a top-down computation
- a bottom-up computation
2018-11-30 09:53:31 +01:00
Émilie Feral
d126f6f9b2 [poincare] Get rid of Expression::reduceChildren which is very alike
deepReduceChildren
2018-11-30 09:53:31 +01:00
Émilie Feral
6d0ca73649 [poincare] Fix getLinearCoefficients & getPolynomialReducedCoefficients: reset the interruption flag
because getLinearCoefficients & getPolynomialReducedCoefficients use deepReduce
2018-11-30 09:53:31 +01:00
Émilie Feral
cf92eb8506 [poincare] Discard useless argument 'replaceSymbols' from simplification
routine
2018-11-30 09:53:31 +01:00
Léa Saviot
2772e0397f [poincare] Add tests on power serailization 2018-11-26 14:07:42 +01:00
Léa Saviot
0ecaea0695 [poincare] Fix power serialization 2018-11-26 14:07:42 +01:00
Léa Saviot
cedcdc2f5f [poincare] Lower the recursion limit on Symbols replacement
The limit is still reasonnable and prevents stack overflows that we do
not handle yet
2018-11-26 13:20:30 +01:00
Léa Saviot
8ef394d440 [poincare] If exception, reset Expression::SymbolReplacementsLock 2018-11-26 13:20:30 +01:00
Léa Saviot
3273de4dac [poincare] Fix Expression::shallowReplaceReplaceableSymbols 2018-11-23 14:46:46 +01:00
Léa Saviot
d7d348deac [poincare] Fix ExpressionNode::shallowReplaceReplaceableSymbols 2018-11-23 12:04:10 +01:00
Léa Saviot
13e8f71150 [poincare] Add parsing tests on layouts 2018-11-23 12:04:10 +01:00
Léa Saviot
6eaf5c70c4 [poincare] Fix parsing of serialised layout [[2^2, 3]] 2018-11-23 12:04:10 +01:00
Léa Saviot
8196036eb3 [poincare] Remove default arguments to TreeNode::serialize
Put them on LayoutNode::serialize
2018-11-23 12:04:10 +01:00
Léa Saviot
69fc876231 [poincare/tests] Add layout serialization+parsing tests 2018-11-23 12:04:10 +01:00
Léa Saviot
75aa84e65f [poincare] Add explicit keyword to Addition constructor 2018-11-23 12:04:10 +01:00
Léa Saviot
3e12f83bb1 [tests] Fix with new serializations 2018-11-23 12:04:10 +01:00
Émilie Feral
123f974bff [poincare] Power: implement (±inf)^x 2018-11-23 12:04:09 +01:00
Émilie Feral
0e3d8514c5 [poincare] Fix tests: first operand of addition does not require
parentheses anymore
2018-11-23 12:04:09 +01:00
Léa Saviot
c30f136fb3 [apps/poincare] Fix cursor position when inserting log(a,b) in 2DEdition 2018-11-23 12:04:09 +01:00
Léa Saviot
53e4a290f7 [poincare] Rename Expression:parse in Parse 2018-11-23 12:04:09 +01:00
Léa Saviot
94603b2b7d [poincare] Layout::serialize is serializeForParsing or ParsedExpression
serializeForParsing serializes the layout once,
serializeParsedExpression serializes the layout, parses it and
serializes it again.
2018-11-23 12:04:09 +01:00
Émilie Feral
2bdce9dd82 [poincare] Power: approximation of power of positive real and real is
real. Fix 10^1000 = inf instead of undef
2018-11-23 12:04:09 +01:00
Léa Saviot
9c788d31d4 [poincare] Do not add parenthesis to often in childNeedsParenthesis 2018-11-23 12:04:09 +01:00
Léa Saviot
39af89d661 [poincare] Fix LayoutNode::canBeOmittedMultiplicationRightFactor 2018-11-23 12:04:09 +01:00
Léa Saviot
67f940dfd2 [poincare] Fix VerticalOffsetLayout serialization
"2^3 !" would be serialized as "2^3*!", which is wrong. It is now serialized
as "2 Ion::Charset::Superscript 3 Ion::Charset::Superscript !" and
parsed correctly.
2018-11-23 12:04:09 +01:00
Émilie Feral
56932fbe04 [poincare] PrintFloat: fix bufferSizeForFloatsWithPrecision (worst case
is -1.234567E-201 for 7 significative digits)
2018-11-23 12:04:09 +01:00
Léa Saviot
5f24c5993c [poincare] Reset sSimplificationHasBeenInterrupted in reduce 2018-11-23 12:04:09 +01:00