From 1629a98bae75f8cc8f97a584527cca819dc2d761 Mon Sep 17 00:00:00 2001 From: Kathryn Wynn Date: Fri, 3 Feb 2023 02:52:07 +0000 Subject: [PATCH 1/3] Updated scicalc with tan(x) function --- scicalc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scicalc b/scicalc index 1667b1d..0130533 100755 --- a/scicalc +++ b/scicalc @@ -2,8 +2,9 @@ # # A simple command-line scientific calculator. # - +# Tangent(x) import sys, math +import numpy as np def die_with_usage(message): print("\n****\n**** error: {}\n****\n".format(message), file=sys.stderr) @@ -47,6 +48,12 @@ def log10(x): """Return a base-10 logarithm of x""" return math.log10(x) + +def tan(x): + """Return the value of tan(x)""" + + return np.tan(x) + # # The dictionary that maps the command-line name of the operation, @@ -58,6 +65,7 @@ operators = { 'sum': add, 'mul': mul, 'log10': log10, + 'tan': tan, } if __name__ == "__main__": From 713855d06c7cbdcca5d8f8e890d227150a716134 Mon Sep 17 00:00:00 2001 From: kwynn03 <123423793+kwynn03@users.noreply.github.com> Date: Thu, 2 Feb 2023 18:53:53 -0800 Subject: [PATCH 2/3] Tab/format error fix --- scicalc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scicalc b/scicalc index 0130533..81a6781 100755 --- a/scicalc +++ b/scicalc @@ -65,7 +65,7 @@ operators = { 'sum': add, 'mul': mul, 'log10': log10, - 'tan': tan, + 'tan': tan, } if __name__ == "__main__": From 5337d7c997ed38cb6a3ec0ce5648fd417d5e3aa8 Mon Sep 17 00:00:00 2001 From: kwynn03 <123423793+kwynn03@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:43:52 -0800 Subject: [PATCH 3/3] Deleted unecessary comments to self --- scicalc | 1 - 1 file changed, 1 deletion(-) diff --git a/scicalc b/scicalc index 81a6781..91e40f2 100755 --- a/scicalc +++ b/scicalc @@ -2,7 +2,6 @@ # # A simple command-line scientific calculator. # -# Tangent(x) import sys, math import numpy as np