Helper functions for solving differential equations.
Differential euqation parser (diffeq.yy) needs to solve derivative of various binary expressions and those are provided below. This implementation is based on original neuron implementation.
- Todo:
- The implementations here are verbose and has duplicate code. Need to revisit this, may be using better library like symengine altogether.
|
template<MathOp Op> |
Term | eval_derivative (const Term &first, const Term &second, bool &deriv_invalid, bool &eqn_invalid) |
|
template<> |
Term | eval_derivative< MathOp::add > (const Term &first, const Term &second, bool &deriv_invalid, bool &eqn_invalid) |
| implement (f(x) + g(x))' = f'(x) + g'(x) More...
|
|
template<> |
Term | eval_derivative< MathOp::sub > (const Term &first, const Term &second, bool &deriv_invalid, bool &eqn_invalid) |
| implement (f(x) - g(x))' = f'(x) - g'(x) More...
|
|
template<> |
Term | eval_derivative< MathOp::mul > (const Term &first, const Term &second, bool &deriv_invalid, bool &eqn_invalid) |
| implement (f(x) * g(x))' = f'(x)g(x) + f(x)g'(x) More...
|
|
template<> |
Term | eval_derivative< MathOp::div > (const Term &first, const Term &second, bool &deriv_invalid, bool &eqn_invalid) |
| Implement (f(x) / g(x))' = (f'(x)g(x) - f(x)g'(x))/g^2(x) Note that the implementation is very limited for the g(x) and this needs to be discussed with Michael. More...
|
|