mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[poincare] Update Division
This commit is contained in:
@@ -52,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
// Simplification
|
||||
virtual Expression shallowReduce(Context& context, Preferences::AngleUnit angleUnit, const Expression futureParent) override;
|
||||
Expression shallowReduce(Context& context, Preferences::AngleUnit angleUnit, const Expression futureParent) override;
|
||||
|
||||
private:
|
||||
template<typename T> static Complex<T> compute(const std::complex<T> c, const std::complex<T> d);
|
||||
|
||||
@@ -65,10 +65,11 @@ Expression Division::shallowReduce(Context& context, Preferences::AngleUnit angl
|
||||
if (result.isUndefinedOrAllocationFailure()) {
|
||||
return result;
|
||||
}
|
||||
Multiplication m = Multiplication(childAtIndex(0));
|
||||
Expression p = Power(childAtIndex(1), Rational(-1));
|
||||
p = p.shallowReduce(context, angleUnit); // Imagine Division(2,1). p would be 1^(-1) which can be simplified
|
||||
Multiplication m = Multiplication(childAtIndex(0), p);
|
||||
return m.shallowReduce(context, angleUnit);
|
||||
p = p.shallowReduce(context, angleUnit, m); // Imagine Division(2,1). p would be 1^(-1) which can be simplified
|
||||
m.addChildAtIndexInPlace(p, m.numberOfChildren(), m.numberOfChildren());
|
||||
return m.shallowReduce(context, angleUnit, futureParent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user