User Guide
nmodl::parser::diffeq Namespace Reference

Helper functions for solving differential equations. More...

Detailed Description

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.

Classes

class  DiffEqContext
 Helper class used by driver and parser while solving diff equation. More...
 
class  Term
 Represent a term in differential equation and it's "current" solution. More...
 

Enumerations

enum  MathOp { MathOp::add = 1, MathOp::sub, MathOp::mul, MathOp::div }
 operators beign supported as part of binary expressions More...
 

Functions

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...
 

Enumeration Type Documentation

◆ MathOp

operators beign supported as part of binary expressions

Enumerator
add 
sub 
mul 
div 

Definition at line 29 of file diffeq_helper.hpp.

Function Documentation

◆ eval_derivative()

template<MathOp Op>
Term nmodl::parser::diffeq::eval_derivative ( const Term first,
const Term second,
bool &  deriv_invalid,
bool &  eqn_invalid 
)
inline

◆ eval_derivative< MathOp::add >()

template<>
Term nmodl::parser::diffeq::eval_derivative< MathOp::add > ( const Term first,
const Term second,
bool &  deriv_invalid,
bool &  eqn_invalid 
)
inline

implement (f(x) + g(x))' = f'(x) + g'(x)

Definition at line 40 of file diffeq_helper.hpp.

◆ eval_derivative< MathOp::div >()

template<>
Term nmodl::parser::diffeq::eval_derivative< MathOp::div > ( const Term first,
const Term second,
bool &  deriv_invalid,
bool &  eqn_invalid 
)
inline

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.

Definition at line 152 of file diffeq_helper.hpp.

◆ eval_derivative< MathOp::mul >()

template<>
Term nmodl::parser::diffeq::eval_derivative< MathOp::mul > ( const Term first,
const Term second,
bool &  deriv_invalid,
bool &  eqn_invalid 
)
inline

implement (f(x) * g(x))' = f'(x)g(x) + f(x)g'(x)

Definition at line 114 of file diffeq_helper.hpp.

◆ eval_derivative< MathOp::sub >()

template<>
Term nmodl::parser::diffeq::eval_derivative< MathOp::sub > ( const Term first,
const Term second,
bool &  deriv_invalid,
bool &  eqn_invalid 
)
inline

implement (f(x) - g(x))' = f'(x) - g'(x)

Definition at line 77 of file diffeq_helper.hpp.