Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding atan #973

Merged
merged 9 commits into from
May 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pybamm/expression_tree/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,20 @@ def _function_diff(self, children, idx):
def tanh(child):
" Returns hyperbolic tan function of child. "
return pybamm.simplify_if_constant(Tanh(child), keep_domains=True)

class Arctan(SpecificFunction):
""" Arctan function """

def __init__(self, child):
super().__init__(np.arctan, child)

def _function_diff(self, children, idx):
""" See :meth:`pybamm.Function._function_diff()`. """
return 1 / (children[0] ** 2 + 1)


def atan(child):
" Returns hyperbolic tan function of child. "
return pybamm.simplify_if_constant(Arctan(child), keep_domains=True)