From 3e183da802245faab51b4e67bd6986f5d62e4bd5 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 14 Aug 2024 08:10:05 -0400 Subject: [PATCH] modified: research/activity24-math-plot.yaml --- research/activity24-math-plot.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/research/activity24-math-plot.yaml b/research/activity24-math-plot.yaml index 9228052..52c5630 100644 --- a/research/activity24-math-plot.yaml +++ b/research/activity24-math-plot.yaml @@ -54,9 +54,12 @@ sections: user_function = re.sub(r'(?<=[a-zA-Z])(?=\d)', '*', user_function) # Replace common math functions with their math module equivalents - math_functions = ['sin', 'cos', 'tan', 'exp', 'log', 'sqrt', 'abs'] + math_functions = [ + 'sin', 'cos', 'tan', 'exp', 'log', 'sqrt', 'abs', 'pi', 'e', 'inf', + 'sinh', 'cosh', 'tanh', 'arctan', + ] for func in math_functions: - user_function = user_function.replace(func, f'numpy.{func}') + user_function = re.sub(r'\b' + func + r'\b', f'numpy.{func}', user_function) # Prepare the x values x = numpy.linspace(-10, 10, 400)