Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plotter/view/puzzletree/nodes/sine.py
diff options
context:
space:
mode:
Diffstat (limited to 'plotter/view/puzzletree/nodes/sine.py')
-rwxr-xr-xplotter/view/puzzletree/nodes/sine.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/plotter/view/puzzletree/nodes/sine.py b/plotter/view/puzzletree/nodes/sine.py
new file mode 100755
index 0000000..493354e
--- /dev/null
+++ b/plotter/view/puzzletree/nodes/sine.py
@@ -0,0 +1,26 @@
+
+from .simplenode import SimpleNode
+from gettext import gettext as _
+
+import math
+
+
+class Sine(SimpleNode):
+ """Node representing the sine function: f(x) = sin(x)."""
+
+ CLASS = "sine"
+ background = SimpleNode.loadbackground("sine.svg")
+ title = _("Sine")
+ description = _(u"Returns the ratio of the length of a side opposite an "
+ u"acute angle in a right trianale to the length of the hypotenuse.\n"
+ u"For example, sin(pi / 4) = 1 / sqrt(2)")
+
+ def __call__(self, x):
+ """Calls the sine function."""
+ return math.sin(x)
+
+
+ def get_equation_string(self, variable):
+ """Returns sin(x) given x."""
+ return "sin(%s)" % variable
+