Commit Graph

1406 Commits

Author SHA1 Message Date
Émilie Feral
a540bfa753 [poincare] Add comment TreeHandle constructor 2019-02-21 11:29:35 +01:00
Émilie Feral
8ca4094e13 [poincare] Un-inline Symbol and Function UntypedBuilder 2019-02-21 11:29:35 +01:00
Émilie Feral
24c9617a89 [poincare] Templatize TreeHandle Builders 2019-02-21 11:29:35 +01:00
Émilie Feral
d29885028b [poincare] Factorize Builders of SymbolAbstract classes 2019-02-21 11:29:35 +01:00
Émilie Feral
fad3ad958d [poincare] SymbolAbstract: the node alignment is handled by the TreePool
and the TreeNode classes. SymbolAbstract and its children class don't
need to watch the alignment.
2019-02-21 11:29:35 +01:00
Émilie Feral
55704b4e65 [poincare] TreeHandle: the constructor from a identifier retains the
node if it has one
2019-02-21 11:29:35 +01:00
Émilie Feral
359fc3a599 [poincare] Create templated methods instead of defining UntypedBuilder
on every expression
2019-02-21 11:29:35 +01:00
Émilie Feral
7b5f3c570d [poincare] Change the way Expression are built 2019-02-21 11:29:35 +01:00
Émilie Feral
902dda34d6 [poincare] Add comment 2019-02-21 11:29:35 +01:00
Émilie Feral
ac6f23684d [poincare] Clean Expression and Layout builders
Before: Opposite(Opposite(Rational(1))) misleadingly created the
expression "-1"; now, Opposite::Builder(Opposite::Builder(Rational(1)))
creates "--1"
2019-02-21 11:29:35 +01:00
Émilie Feral
02b27124f4 [poincare] Integer: remove duplicate method: isInfinite is equivalent to
isOverflow
2019-02-05 16:42:36 +01:00
Émilie Feral
f4d63a2160 [poincare] Integer are allocated on the TreePool instead of using their
own buffer. Short Integers are kept in the handle as an optimization.
2019-02-05 16:42:36 +01:00
Émilie Feral
79f0834f4e [poincare] Add method 'hasNode' on TreeHandle 2019-02-05 16:42:36 +01:00
Émilie Feral
3caf165621 [poincare] Factorize code in method:
Expression::recursivelyMatchesInfinity
2019-02-01 10:40:03 +01:00
Émilie Feral
476c42c42e [poincare] Store: shallowReducing and approximating a store do the same
thing: storing the expression for the corresponding symbol
2019-01-22 14:57:38 +01:00
Léa Saviot
86f03b800d [poincare] Clean the TrigonometryCheatTable
It caused Travis compilation problems
2019-01-21 11:22:55 +01:00
Léa Saviot
0bf3e678d9 [poincare] Add tests and asserts about sign, such as sign(0)==0 2019-01-21 11:22:55 +01:00
Émilie Feral
f6026254be [poincare] Add an argument ReductionTarget to shallowBeautify 2019-01-10 11:42:05 +01:00
Émilie Feral
a24f65bd46 [poincare] Revert special case when approximating x^(p/q) with x real
and p, q integer

That hugely slows down the approximation routine
2019-01-10 11:42:05 +01:00
Émilie Feral
9709fb66b1 [poincare] When approximating, make a special case for x^(p/q) when the
complex format is real.

In this case, x^(p/q) might have a real result which is not the
principale angle returned by the standard library
2019-01-10 11:42:05 +01:00
Émilie Feral
1251821d3e [poincare] Change name: ReductionTarget::TopDownComputation -->
ReductionTarget::System
2019-01-10 11:42:05 +01:00
Émilie Feral
c6cf0eb000 [poincare] Discard BottomUpComputation of ReductionTarget because it is
never used
2019-01-10 11:42:05 +01:00
Émilie Feral
4841542750 [poincare] Add ComplexFormat argument to the approximation routine 2019-01-10 11:42:05 +01:00
Léa Saviot
e5f0959239 [poincare] Static Expression methods start with uppercase 2019-01-10 11:42:05 +01:00
Léa Saviot
8a2bdb4c42 [poincare] When reducing store, handle non reductible left side 2019-01-10 11:42:04 +01:00
Léa Saviot
892dd2de4f [apps/poincare] Clean some comments 2019-01-10 11:42:04 +01:00
Léa Saviot
300e797324 [poincare/store] Store shallow reduces into the reduced left operand 2019-01-10 11:42:04 +01:00
Émilie Feral
284a020de3 [poincare] Constant: order constant e, i and pi correctly 2019-01-10 11:42:04 +01:00
Émilie Feral
83bb2f1221 [poincare] Fix Expression::CreateComplexExpression: should not check the sApproximationEncounteredComplex here as this method is also used int the reduction routine 2019-01-10 11:42:04 +01:00
Émilie Feral
65527f22b2 [poincare] Remove duplicate calls to SetEncounterComplex 2019-01-10 11:42:04 +01:00
Émilie Feral
97b13bae5d [poincare] Fix SimplificationOrder:
Sorting cos(2)*pi should return pi*cos(2)
Sorting pi+cos(2) should return cos(2)+pi
2019-01-10 11:42:04 +01:00
Émilie Feral
ad8f0a73d9 [poincare] Fix Addition::shallowBeautify
B+A should be beautified in A+B
1+x should be beautified in x+1
2019-01-10 11:42:04 +01:00
Émilie Feral
3fd737ab72 [poincare] Change name: sApproximationEncounterComplex -->
sApproximationEncounteredComplex
2019-01-10 11:42:04 +01:00
Émilie Feral
4e345b7050 [poincare] Unreal: approximating unreal set the sApproximationEncounterComplex to true 2019-01-10 11:42:04 +01:00
Émilie Feral
ecf3f2ea0f [poincare] Create a a flag on Expression that is set when the
approximation encouters a complex value

All approximation methods take the complex format into account.
2019-01-10 11:42:04 +01:00
Émilie Feral
c3ad0e027c [poincare] Create class Unreal 2019-01-10 11:42:04 +01:00
Émilie Feral
5e434a4c33 [poincare] Get rid of useless arguments in shallowReduce 2019-01-10 11:42:04 +01:00
Émilie Feral
26e2e9be0d [poincare] Add complex format as an argument of simplification 2019-01-10 11:42:04 +01:00
Émilie Feral
1f247b731d [poincare] Discard useless parameters of sign and isReal methods 2019-01-10 11:42:04 +01:00
Émilie Feral
8bc1a7be05 [poincare] Preferences: add a ComplexFormat::Real 2019-01-10 11:42:04 +01:00
Émilie Feral
c0424089f7 [poincare] Clean Power 2019-01-10 11:42:03 +01:00
Émilie Feral
5e79949ba7 [poincare] Clean Trigonometry 2019-01-10 11:42:03 +01:00
Émilie Feral
f00f639bed [poincare] Interrupt simplification of when too many nodes where
generated while bubbling up ComplexCartesian. Retry with another
ReductionTarget
2019-01-10 11:42:03 +01:00
Émilie Feral
1671ee8ec8 [poincare] Fix Undefined:: isReal is false 2019-01-10 11:42:03 +01:00
Émilie Feral
c4758873d2 [poincare] ComplexCartesian: when computing the squareNorm, simplify
cos^2+sin^2
2019-01-10 11:42:03 +01:00
Émilie Feral
9401edfd3f [poincare] Clean outdated comment 2019-01-10 11:42:03 +01:00
Émilie Feral
ff77b46276 [poincare] Power::shallowReduce. Fix bug: I complex should always be
shallowReduced as it turns into ComplexCartesian(0,1) if the reduction
target is the User and stays Constant(I) otherwise.
2019-01-10 11:42:03 +01:00
Émilie Feral
c6039423a9 [poincare] When simplifying an expression, also compute the approximation from the reduced
expression to avoid loss of precision.

If an expression is reduced to a ComplexCartesian(a, b), we compute the
approximation from ComplexCartesian(a,b) instead of going through the
potentially complicated expression resulting from beautifying
(sqrt(a^2+b^2)*exp(i*(arctan(b/a) -Pi/2*sign(b)) for example)
2019-01-10 11:42:03 +01:00
Émilie Feral
dae5c4d2d4 [poincare] Constant: i->ComplexCartesian(0,1) only if the reduction
target is the user
2019-01-10 11:42:03 +01:00
Émilie Feral
38de794642 [poincare] Change signature setSign(Context, AngleUnit, ReductionTarget) 2019-01-10 11:42:03 +01:00