[poincare] Added framework to derivate unary functions, and implemented it for Sine

Added a method unaryFunctionDifferential to ExpressionNode and Expression, to be implemented by subclasses representing unary functions.
Added a function derivateUnaryFunction to Derivative, to factor (f°g)' -> g' * f'°g.

Change-Id: Id1780f1082ccd001f1282fe4ddfff2b7055d3a27
This commit is contained in:
Gabriel Ozouf
2020-05-20 10:54:12 +02:00
committed by Émilie Feral
parent 648cdbaa29
commit 5cf85368ea
8 changed files with 48 additions and 2 deletions

View File

@@ -131,6 +131,10 @@ bool ExpressionNode::didDerivate(ReductionContext reductionContext, Expression s
return Expression(this).defaultDidDerivate();
}
Expression ExpressionNode::unaryFunctionDifferential() {
return Expression(this).defaultUnaryFunctionDifferential();
}
bool ExpressionNode::isOfType(Type * types, int length) const {
for (int i = 0; i < length; i++) {
if (type() == types[i]) {