Commit Graph

1406 Commits

Author SHA1 Message Date
Émilie Feral
8a00aa16cc [poincare] Clean: remove complexCartesian and complexPolar methods 2019-01-10 11:42:03 +01:00
Émilie Feral
cbd4f44539 [poincare] SignFunction: improve shallowReduce: sign(-x) = -sign(x) 2019-01-10 11:42:03 +01:00
Émilie Feral
383ac004cf [poincare] Take into account complex format in simplify 2019-01-10 11:42:03 +01:00
Émilie Feral
a6ac075442 [poincare] Fix Expression::CreateComplexExpression 2019-01-10 11:42:03 +01:00
Émilie Feral
cbef3dadb9 [poincare] Implement real and shallowReduce of ComplexCartesian on nodes: conjugate, function, symbol 2019-01-10 11:42:03 +01:00
Émilie Feral
3292bdfd44 [poincare] Sketch of complex reduction as part of the reduce routine 2019-01-10 11:42:03 +01:00
Émilie Feral
f714699575 [poincare] Clean Expression::CreateComplexExpression 2019-01-10 11:42:03 +01:00
Émilie Feral
9efc9e02e6 [poincare] Revert simplifyForComplexFormat 2019-01-10 11:42:03 +01:00
Émilie Feral
2e89f8b7de [poincare] Expression::simplifyForComplexFormat: Use a shortcut if the expression approximation is a real pure 2019-01-10 11:42:03 +01:00
Émilie Feral
7d9c49919c [poincare] simplifyForComplexFormat: before extracting
ComplexCartesian/ComplexPolar, deepReduce instead of simplify to avoid
generating uselessly big trees. To make it work, implement shortcuts for
Power::complexCartesian and Power::complexPolar to return nice cartesian
expression when the power index is -1, 1/2 or -1/2
2019-01-10 11:42:03 +01:00
Émilie Feral
c62922ec5c [poincare] Change complex getters design: extract real and imaginary
parts at the same time in complexCartesian and norm and arg in
complexPolar
2019-01-10 11:42:03 +01:00
Émilie Feral
64aebcf16d [poincare] Implement shallowReduce of ComplexArgument, AbsoluteValue,
RealPart and ImaginaryPart
2019-01-10 11:42:03 +01:00
Émilie Feral
2f8ede54f2 [poincare] The sign function was used to decide wether an expression was
of form -x. However, ln(0.3) has a negative sign but is not of form -x.
This commit fixes the misuse of ExpressionNode::Sign::negative.
For example, we do not turn sin(tan(9)) in -sin(-tan(9)) or
arcsin(sin(12)) in -arcsin(-sin(12) because tan(9)<0 and sin(12)<0
2019-01-10 11:42:03 +01:00
Émilie Feral
9e2b709fcb [poincare] Change sign() signature to sign(context, angleUnit) 2019-01-10 11:42:03 +01:00
Émilie Feral
f8251a74bc [poincare] SquareRoot: use realPart and imaginaryPart to compute the
complexArgument
2019-01-10 11:42:03 +01:00
Émilie Feral
d72b906919 [poincare] SquareRoot: implement realPart & imaginaryPart 2019-01-10 11:42:03 +01:00
Émilie Feral
ee0d158bd9 [poincare] Add rules on cos(arcsin), cos(arctan), sin(arccos),
sin(arctan), tan(arccos), tan(arcsin)
2019-01-10 11:42:03 +01:00
Émilie Feral
5dae60bc7e [poincare] Complex parts getters (realPart, imaginaryPart,
complexNorm...) simplify while building the complex part
2019-01-10 11:42:03 +01:00
Émilie Feral
56c8e8b704 [poincare] Expression: create method ParseAndSimplifyForComplexFormat 2019-01-10 11:42:03 +01:00
Émilie Feral
f452d8fced [poincare] Fatorize code of Complex::complexToExpression in
Expression::CreateComplexExpression that create the expression a+i*b or
r*e^(i*th) from 2 expressions representing a & b or r & th.
2019-01-10 11:42:03 +01:00
Émilie Feral
476a79565f [poincare] Number::setSign does not need a context or angleUnit 2019-01-10 11:42:03 +01:00
Émilie Feral
fe6a5af47b [poincare] Change Expression::setSign signature 2019-01-10 11:42:03 +01:00
É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
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
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
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
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
cf92eb8506 [poincare] Discard useless argument 'replaceSymbols' from simplification
routine
2018-11-30 09:53:31 +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
8196036eb3 [poincare] Remove default arguments to TreeNode::serialize
Put them on LayoutNode::serialize
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
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
Léa Saviot
39af89d661 [poincare] Fix LayoutNode::canBeOmittedMultiplicationRightFactor 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
70707a9985 [poincare] Infinity::Name() gives "inf" 2018-11-23 12:04:08 +01:00