mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[solver] Modified the way to solve some equations
The solutions of equations that need numerical approximations to be solved are now computed base on the undeveloped equation (instead of fully the expended one used to identify polynomials) This allow (x-10)^7=0 to yield x=10 as result (9.95 before) Change-Id: Ia8acbe57a9cfebf0b5016e9c896d21c8ddac7a64
This commit is contained in:
committed by
Émilie Feral
parent
6e9a5a010f
commit
913c81a0d3
@@ -39,7 +39,7 @@ public:
|
||||
static Equal Builder(Expression child0, Expression child1) { return TreeHandle::FixedArityBuilder<Equal, EqualNode>({child0, child1}); }
|
||||
|
||||
// For the equation A = B, create the reduced expression A-B
|
||||
Expression standardEquation(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, Preferences::UnitFormat unitFormat) const;
|
||||
Expression standardEquation(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, Preferences::UnitFormat unitFormat, ExpressionNode::ReductionTarget reductionTarget) const;
|
||||
// Expression
|
||||
Expression shallowReduce();
|
||||
};
|
||||
|
||||
@@ -44,13 +44,9 @@ Evaluation<T> EqualNode::templatedApproximate(Context * context, Preferences::Co
|
||||
}
|
||||
|
||||
|
||||
Expression Equal::standardEquation(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, Preferences::UnitFormat unitFormat) const {
|
||||
Expression Equal::standardEquation(Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit, Preferences::UnitFormat unitFormat, ExpressionNode::ReductionTarget reductionTarget) const {
|
||||
Expression sub = Subtraction::Builder(childAtIndex(0).clone(), childAtIndex(1).clone());
|
||||
/* When reducing the equation, we specify the reduction target to be
|
||||
* SystemForAnalysis. This enables to expand Newton multinom to be able to
|
||||
* detect polynom correctly ("(x+2)^2" in this form won't be detected
|
||||
* unless expanded). */
|
||||
return sub.reduce(ExpressionNode::ReductionContext(context, complexFormat, angleUnit, unitFormat, ExpressionNode::ReductionTarget::SystemForAnalysis));
|
||||
return sub.reduce(ExpressionNode::ReductionContext(context, complexFormat, angleUnit, unitFormat, reductionTarget));
|
||||
}
|
||||
|
||||
Expression Equal::shallowReduce() {
|
||||
|
||||
Reference in New Issue
Block a user