Skip to content

Commit

Permalink
Merge pull request #4 from GregoryNavasarkian/development
Browse files Browse the repository at this point in the history
Add GUI Functionality
  • Loading branch information
GregoryNavasarkian authored Mar 31, 2023
2 parents 343f438 + 78134f9 commit 164afe1
Show file tree
Hide file tree
Showing 12 changed files with 336 additions and 158 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
__pycache__
*.pyc
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/Algebra-App.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

Binary file removed DaGrapher.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions functions.py
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)
27 changes: 27 additions & 0 deletions graph.py
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()
Loading

0 comments on commit 164afe1

Please sign in to comment.