mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-28 10:09:53 +01:00
[poincare] Fix Expression::simplifyAndApproximate to display polar form
of negative real expression. -5 --> 5*e^(i*Pi)
This commit is contained in:
@@ -402,10 +402,10 @@ void Expression::simplifyAndApproximate(Expression * simplifiedExpression, Expre
|
||||
Expression e = deepReduce(context, angleUnit, ExpressionNode::ReductionTarget::User);
|
||||
*simplifiedExpression = Expression();
|
||||
if (!sSimplificationHasBeenInterrupted) {
|
||||
/* Case 1: the reduced expression is ComplexCartesian, we can take
|
||||
* into account the complex format to display a+i*b or r*e^(i*th) */
|
||||
if (e.type() == ExpressionNode::Type::ComplexCartesian) {
|
||||
ComplexCartesian ecomplex = static_cast<ComplexCartesian &>(e);
|
||||
/* Case 1: the reduced expression is ComplexCartesian or pure real, we can
|
||||
* take into account the complex format to display a+i*b or r*e^(i*th) */
|
||||
if (e.type() == ExpressionNode::Type::ComplexCartesian || e.isReal(context, angleUnit)) {
|
||||
ComplexCartesian ecomplex = e.type() == ExpressionNode::Type::ComplexCartesian ? static_cast<ComplexCartesian &>(e) : ComplexCartesian::Builder(e, Rational(0));
|
||||
if (approximateExpression) {
|
||||
/* Step 2: Approximation
|
||||
* We compute the approximate expression from the Cartesian form to avoid
|
||||
|
||||
Reference in New Issue
Block a user