modified: research/activity24-math-plot.yaml

This commit is contained in:
Russell Ballestrini 2024-08-14 08:10:05 -04:00
parent c7086f6ee9
commit 3e183da802

View file

@ -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)