-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from GregoryNavasarkian/development
Add GUI Functionality
- Loading branch information
Showing
12 changed files
with
336 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
__pycache__ | ||
*.pyc |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import math | ||
from graph import Graph | ||
|
||
class Functions: | ||
""" | ||
Class for functions | ||
""" | ||
|
||
def linear(self, m, b): | ||
""" | ||
Linear function | ||
""" | ||
x = range(-8, 8) | ||
y = [m * i + b for i in x] | ||
return Graph(x, y) | ||
|
||
def quadratic(self, a, b, c): | ||
""" | ||
Quadratic function | ||
""" | ||
x = range(-8, 8) | ||
y = [a * i ** 2 + b * i + c for i in x] | ||
return Graph(x, y) | ||
|
||
def cubic(self, a, b, c, d): | ||
""" | ||
Cubic function | ||
""" | ||
x = range(-8, 8) | ||
y = [a * i ** 3 + b * i ** 2 + c * i + d for i in x] | ||
return Graph(x, y) | ||
|
||
def exponential(self, a, b): | ||
""" | ||
Exponential function | ||
""" | ||
x = range(-4, 8) | ||
y = [a * b ** i for i in x] | ||
return Graph(x, y) | ||
|
||
def logarithmic(self, b): | ||
""" | ||
Logarithmic function | ||
""" | ||
x = range(1, 15) | ||
y = [math.log(i, b) for i in x] | ||
return Graph(x, y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from matplotlib import pyplot as plt | ||
import math | ||
|
||
class Graph: | ||
""" | ||
Class for graphing functions | ||
""" | ||
|
||
def __init__(self, x, y): | ||
self.x = x | ||
self.y = y | ||
|
||
def plot(self): | ||
fig = plt.figure(figsize=(15, 12)) | ||
plt.xticks(range(min(self.x), max(self.x) + 1)) | ||
ax = fig.add_subplot(111) | ||
|
||
plt.plot(self.x, self.y) | ||
ax.spines['top'].set_color('none') | ||
ax.spines['right'].set_color('none') | ||
ax.spines['bottom'].set_position('zero') | ||
ax.spines['left'].set_position('zero') | ||
|
||
plt.scatter(0, 0) | ||
|
||
plt.grid(True) | ||
plt.show() |
Oops, something went wrong.