├── .gitignore ├── README.md ├── archive ├── 3D.py ├── Calculator.py ├── CommonPointArea.py ├── Definite Integration.py ├── Derivative.py ├── Differential Equations.py ├── Indefinite Integration.py ├── Plotter.py ├── Polar.py ├── Polynomial Graph.py └── n-Derivative.py ├── requirements.txt └── src └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GPython 2 | Recreated the popular graphing application "Desmos" on Python. GPython uses [scipy](https://www.scipy.org/), [matplotlib](https://matplotlib.org/), and [numpy](https://numpy.org/) to create graphs based on functions. It is capable of solving differential equations and indefinite and definite integration. 3 | 4 | # How to run? 5 | Features can be tested by running: 6 | ```python .py``` 7 | 8 | # Dependencies 9 | * matplotlib 10 | * scipy 11 | * numpy 12 | 13 | #End Goal 14 | GPython will run on a GUI and all equations will be supported for graphing. 15 | 16 | #Contribution Guidelines 17 | Check issues for ways to contribute. 18 | 19 | #Contributors 20 | [Aditeya Baral](https://github.com/aditeyabaral) 21 | -------------------------------------------------------------------------------- /archive/3D.py: -------------------------------------------------------------------------------- 1 | import matplotlib as mpl 2 | from mpl_toolkits.mplot3d import Axes3D 3 | import numpy as np 4 | from math import * 5 | import matplotlib.pyplot as plt 6 | s = str(input("Enter function : ")) 7 | temp = s 8 | t1,t2,t3 = s.find('x'),s.find('y'),s.find('z') 9 | s= s.replace('x','(x)') 10 | s =s.replace('y','(y)') 11 | ctr1, ctr2, x, y, z = -10, -10, [], [],[] 12 | while ctr1<=10: 13 | ctr2=-10 14 | while ctr2<=10: 15 | s1 = '' 16 | add = 0 17 | s1 = s.replace('x',str(ctr1)) 18 | s1 = s1.replace('y',str(ctr2)) 19 | try: 20 | add = eval(s1) 21 | x.append(ctr1) 22 | y.append(ctr2) 23 | z.append(add) 24 | except: 25 | pass 26 | ctr2+=0.1 27 | ctr1+=0.1 28 | fig = plt.figure(num = 'GPYTHON') 29 | ax = fig.gca(projection='3d') 30 | ax.plot(x, y, z,label = 'z = '+temp) 31 | ax.set_xlabel('X Axis') 32 | ax.set_ylabel('Y Axis') 33 | ax.set_zlabel('Z Axis') 34 | #plt.zlabel('z - axis') 35 | plt.grid(True) 36 | #add color = 'red' for colour in above line 37 | ax.legend() 38 | plt.show() 39 | 40 | -------------------------------------------------------------------------------- /archive/Calculator.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | import math 3 | 4 | 5 | class Calc(): 6 | def __init__(self): 7 | self.total = 0 8 | self.current = "" 9 | self.new_num = True 10 | self.op_pending = False 11 | self.op = "" 12 | self.eq = False 13 | 14 | def num_press(self, num): 15 | self.eq = False 16 | temp = text_box.get() 17 | temp2 = str(num) 18 | if self.new_num: 19 | self.current = temp2 20 | self.new_num = False 21 | else: 22 | if temp2 == '.': 23 | if temp2 in temp: 24 | return 25 | self.current = temp + temp2 26 | self.display(self.current) 27 | 28 | 29 | def calc_total(self): 30 | self.eq = True 31 | self.current = float(self.current) 32 | if self.op_pending == True: 33 | self.do_sum() 34 | else: 35 | self.total = float(text_box.get()) 36 | 37 | def display(self, value): 38 | text_box.delete(0, END) 39 | text_box.insert(0, value) 40 | 41 | def do_sum(self): 42 | if self.op == "add": 43 | self.total += self.current 44 | if self.op == "minus": 45 | self.total -= self.current 46 | if self.op == "times": 47 | self.total *= self.current 48 | if self.op == "divide": 49 | self.total /= self.current 50 | if self.op == "raise": 51 | self.total = self.total ** self.current 52 | if self.op == "rootof": 53 | self.total = self.total ** (1/self.current) 54 | if self.op == "fact": 55 | self.total=int(text_box.get()) 56 | self.total=math.factorial(self.total) 57 | if self.op == "ln": 58 | self.total = math.log(self.total) 59 | if self.op == "log": 60 | self.total= math.log(self.total,10) 61 | if self.op == "sine": 62 | self.total=math.sin(self.total) 63 | if self.op == "cosine": 64 | self.total = math.cos(self.total) 65 | if self.op == "tangent": 66 | self.total = math.tan(self.total) 67 | if self.op == "exp": 68 | self.total = math.exp(self.total) 69 | if self.op == "inv": 70 | self.total = 1/self.total 71 | self.new_num = True 72 | self.op_pending = False 73 | self.display(self.total) 74 | 75 | def operation(self, op): 76 | self.current = float(self.current) 77 | if self.op_pending: 78 | self.do_sum() 79 | elif not self.eq: 80 | self.total = self.current 81 | self.new_num = True 82 | self.op_pending = True 83 | self.op = op 84 | self.eq = False 85 | 86 | def clear(self): 87 | self.eq = False 88 | self.current = "0" 89 | self.display(0) 90 | self.new_num = True 91 | 92 | def all_clear(self): 93 | self.clear() 94 | self.total = 0 95 | 96 | def sign(self): 97 | self.eq = False 98 | self.current = -(float(text_box.get())) 99 | self.display(self.current) 100 | 101 | sum1 = Calc() 102 | root = Tk() 103 | calc = Frame(root) 104 | calc.grid() 105 | 106 | root.title("Calculator") 107 | text_box = Entry(calc, justify=RIGHT,width=30,font="Times 16 bold") 108 | text_box.grid(row = 0, column = 0,columnspan = 8,padx=30, pady = 30) 109 | text_box.insert(0, "0") 110 | #text_box.focus() 111 | 112 | numbers = "789456123" 113 | i = 0 114 | bttn = [] 115 | for j in range(1,4): 116 | for k in range(3): 117 | bttn.append(Button(calc,height =2,width=4,padx=10, pady = 10, text = numbers[i])) 118 | bttn[i]["bg"]= "orange" 119 | bttn[i].grid(row = j, column = k,padx=1,pady=1) 120 | bttn[i]["command"] = lambda x = numbers[i]: sum1.num_press(x) 121 | i += 1 122 | 123 | bttn_0 = Button(calc,height =2,width=4,padx=10, pady = 10, text = "0",bg="orange") 124 | bttn_0["command"] = lambda: sum1.num_press(0) 125 | bttn_0.grid(row = 4, column = 0, padx=1, pady = 1) 126 | 127 | div = Button(calc,height =2,width=4,padx=10, pady = 10, text = "/",bg="steel blue") 128 | div["command"] = lambda: sum1.operation("divide") 129 | div.grid(row = 1, column = 3, padx=1, pady = 1) 130 | 131 | mult = Button(calc,height =2,width=4,padx=10, pady = 10, text = "*",bg="steel blue") 132 | mult["command"] = lambda: sum1.operation("times") 133 | mult.grid(row = 2, column = 3, padx=1, pady = 1) 134 | 135 | minus = Button(calc,height =2,width=4,padx=10, pady = 10, text = "-",bg="steel blue") 136 | minus["command"] = lambda: sum1.operation("minus") 137 | minus.grid(row = 3, column = 3, padx=1, pady = 1) 138 | 139 | add = Button(calc,height =2,width=4,padx=10, pady = 10, text = "+",bg="steel blue") 140 | add["command"] = lambda: sum1.operation("add") 141 | add.grid(row = 4, column = 3, padx=1, pady = 1) 142 | 143 | power = Button(calc, height=2,width=4,padx=10,pady=10,text="x^y",bg="green") 144 | power["command"] = lambda: sum1.operation("raise") 145 | power.grid(row=2,column = 4,padx=1,pady=1) 146 | 147 | rootof = Button(calc, height=2, width=4, padx=10, pady=10, text="y-\/x", bg = "green") 148 | rootof["command"] = lambda: sum1.operation("rootof") 149 | rootof.grid(row=2, column=5, padx=1, pady=1) 150 | 151 | fact = Button(calc, height=2, width=4, padx=10, pady=10, text="!",bg="green") 152 | fact["command"] = lambda: sum1.operation("fact") 153 | fact.grid(row=3,column=4, padx=1, pady=1) 154 | 155 | loge = Button(calc, height=2, width=4, padx=10, pady=10, text="ln",bg="green") 156 | loge["command"] = lambda: sum1.operation("ln") 157 | loge.grid(row=3, column=5, padx=1, pady=1) 158 | 159 | log10 = Button(calc, height=2, width=4, padx=10, pady=10, text="log",bg="green") 160 | log10["command"]= lambda: sum1.operation("log") 161 | log10.grid(row=4, column=4, padx=1 , pady=1) 162 | 163 | sine = Button(calc, height=2,width=4, padx=10,pady=10, text = "sin" , bg= "green") 164 | sine["command"]=lambda: sum1.operation("sine") 165 | sine.grid(row=5,column=0,padx=1,pady=1) 166 | 167 | cosine = Button(calc, height=2,width=4, padx=10,pady=10, text = "cos" , bg= "green") 168 | cosine["command"]=lambda: sum1.operation("cosine") 169 | cosine.grid(row=5,column=1,padx=1,pady=1) 170 | 171 | tangent = Button(calc, height=2,width=4, padx=10,pady=10, text = "tan" , bg= "green") 172 | tangent["command"]=lambda: sum1.operation("tangent") 173 | tangent.grid(row=5,column=2,padx=1,pady=1) 174 | 175 | exponent = Button(calc, height=2, width=4, padx=10, pady=10, text='e^x', bg="green") 176 | exponent["command"]=lambda: sum1.operation("exp") 177 | exponent.grid(row=5,column=3,padx=1,pady=1) 178 | 179 | inv = Button(calc, height=2, width=4, padx=10, pady=10, text="1/x", bg="green") 180 | inv["command"] = lambda: sum1.operation("inv") 181 | inv.grid(row=5,column=4,padx=1,pady=1) 182 | 183 | point = Button(calc,height =2,width=4,padx=10, pady = 10, text = ".",bg="white") 184 | point["command"] = lambda: sum1.num_press(".") 185 | point.grid(row = 4, column = 1, padx=1, pady = 1) 186 | 187 | neg= Button(calc,height =2,width=4,padx=10, pady = 10, text = "+/-",bg="white") 188 | neg["command"] = sum1.sign 189 | neg.grid(row = 4, column = 2, padx=1, pady = 1) 190 | 191 | 192 | clear = Button(calc,height =2,width=4,padx=10, pady = 10, text = "C",bg="white") 193 | clear["command"] = sum1.clear 194 | clear.grid(row = 1, column = 4, padx=1, pady = 1) 195 | 196 | all_clear = Button(calc,height =2,width=4,padx=10, pady = 10, text = "AC",bg="white") 197 | all_clear["command"] = sum1.all_clear 198 | all_clear.grid(row = 1, column = 5, padx=1, pady = 1) 199 | 200 | equals = Button(calc,height =6,width=4,padx=10, pady = 10, text = "=",bg="green") 201 | equals["command"] = sum1.calc_total 202 | equals.grid(row = 4, column = 5,columnspan=1,rowspan=2,padx=1, pady = 1) 203 | 204 | root.mainloop() 205 | -------------------------------------------------------------------------------- /archive/CommonPointArea.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from math import * 3 | add = 0 4 | global x1,x2,y1,y2 5 | s1 = str(input("Enter function 1: ")) 6 | s2 = str(input("Enter function 2: ")) 7 | temp1, temp2 = s1,s2 8 | s1= s1.replace('x','(x)') 9 | s2= s2.replace('x','(x)') 10 | f = lambda x: eval(s1) 11 | g = lambda x: eval(s2) 12 | ctr, x1, y1,x2,y2 = -10, [], [],[],[] 13 | a1,a2 = [],[] 14 | while ctr<=10: 15 | try: 16 | add1 = f(ctr) 17 | x1.append(ctr) 18 | y1.append(add1) 19 | point = [ctr,add1] 20 | a1.append(point) 21 | 22 | except: 23 | pass 24 | try: 25 | add2 = g(ctr) 26 | x2.append(ctr) 27 | y2.append(add2) 28 | point = [ctr,add2] 29 | a2.append(point) 30 | except: 31 | pass 32 | ctr+=1 33 | a3 = [] 34 | for i in a1: 35 | if i in a2: 36 | a3.append(i) 37 | nx,ny = [],[] 38 | for i in a3: 39 | nx.append(i[0]) 40 | beg = nx[0] 41 | x1,y1,x2,y2 = [],[],[],[] 42 | for i in nx[1:]: 43 | ctr = beg 44 | add1,add2 = 0,0 45 | while ctr<=i: 46 | try: 47 | add1 = f(ctr) 48 | x1.append(ctr) 49 | y1.append(add1) 50 | except: 51 | pass 52 | try: 53 | add2 = g(ctr) 54 | x2.append(ctr) 55 | y2.append(add2) 56 | except: 57 | pass 58 | ctr+=0.01 59 | beg = i 60 | plt.figure(num ='GPYTHON') 61 | plt.plot(x1,y1,label = 'y = '+temp1,color = 'blue') 62 | plt.plot(x2,y2,label = 'y = '+temp2,color = 'red') 63 | plt.xlabel('X Axis') 64 | plt.ylabel('Y Axis') 65 | ax = plt.gca() 66 | plt.grid(True) 67 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 68 | ax.spines['right'].set_color('none') 69 | ax.spines['top'].set_color('none') 70 | ax.xaxis.set_ticks_position('bottom') 71 | ax.spines['bottom'].set_position(('data',0)) 72 | ax.yaxis.set_ticks_position('left') 73 | ax.spines['left'].set_position(('data',0)) 74 | plt.show() 75 | plt.close() 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /archive/Definite Integration.py: -------------------------------------------------------------------------------- 1 | from scipy import integrate 2 | from math import * 3 | import numpy as np 4 | import matplotlib as plt 5 | s = input('Enter : ') 6 | f = lambda x:eval(s) 7 | a = (integrate.quad(f,0,5)) 8 | print (a[0]) 9 | -------------------------------------------------------------------------------- /archive/Derivative.py: -------------------------------------------------------------------------------- 1 | from scipy.misc import derivative 2 | import numpy as np 3 | from scipy import integrate 4 | import matplotlib.pyplot as plt 5 | from numpy import * 6 | from math import * 7 | #X = np.arange(-10,10,0.01) 8 | #x=X 9 | s=input("Enter function : ") 10 | temp = s 11 | s = s.replace('x','(x)') 12 | f = lambda x:eval(s) 13 | x,y = [],[] 14 | ctr = -10 15 | while ctr <=10: 16 | x.append(ctr) 17 | try: 18 | y.append(derivative(f,ctr)) 19 | except: 20 | y.append(None) 21 | ctr+=0.01 22 | '''def F(x): 23 | res = np.zeros_like(x) 24 | for i,val in enumerate(x): 25 | try: 26 | y = derivative(f,val) 27 | res[i]=y 28 | except: 29 | res[i] = None 30 | return res''' 31 | plt.figure(num ='GPYTHON') 32 | plt.plot(x,y,label = 'y = '+temp,color = 'black') 33 | plt.xlabel('X Axis') 34 | plt.ylabel('Y Axis') 35 | plt.title('Derivative of '+temp) 36 | #plt.style.use('ggplot') 37 | ax = plt.gca() 38 | plt.grid() 39 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 40 | ax.spines['right'].set_color('none') 41 | ax.spines['top'].set_color('none') 42 | ax.xaxis.set_ticks_position('bottom') 43 | ax.spines['bottom'].set_position(('data',0)) 44 | ax.yaxis.set_ticks_position('left') 45 | ax.spines['left'].set_position(('data',0)) 46 | plt.show() 47 | plt.close() 48 | -------------------------------------------------------------------------------- /archive/Differential Equations.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy.integrate import odeint 3 | import matplotlib.pyplot as plt 4 | from math import * 5 | s = str(input("Enter function : ")) 6 | temp = s 7 | #s= s.replace('x','(y)') 8 | f = lambda x:eval(s) 9 | # function that returns dy/dt 10 | def model(x,t): 11 | #k = 0.3 12 | dxdt = f 13 | return dxdt 14 | 15 | # initial condition 16 | x0 = 5 17 | 18 | # time points 19 | t = np.linspace(0,20) 20 | 21 | # solve ODE 22 | y = odeint(model,x0,t) 23 | #print (y) 24 | 25 | # plot results 26 | plt.plot(t,y) 27 | plt.xlabel('time') 28 | plt.ylabel('y(t)') 29 | plt.show() 30 | -------------------------------------------------------------------------------- /archive/Indefinite Integration.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy import integrate 3 | import matplotlib.pyplot as plt 4 | from numpy import * 5 | from math import * 6 | X = np.arange(-10,10,0.01) 7 | #plot(X,f(X)) 8 | s = input('Enter : ') 9 | f = lambda x:eval(s) 10 | def F(x): 11 | res = np.zeros_like(x) 12 | for i,val in enumerate(x): 13 | y,err = integrate.quad(f,0,val) 14 | res[i]=y 15 | return res 16 | #plt.plot(X,F(X)) 17 | plt.plot(X,F(X),label = s,color = 'black') 18 | plt.xlabel('x - axis') 19 | plt.ylabel('y - axis') 20 | #plt.title(temp.upper()) 21 | #plt.style.use('ggplot') 22 | ax = plt.gca() 23 | plt.grid(True) 24 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 25 | ax.spines['right'].set_color('none') 26 | ax.spines['top'].set_color('none') 27 | ax.xaxis.set_ticks_position('bottom') 28 | ax.spines['bottom'].set_position(('data',0)) 29 | ax.yaxis.set_ticks_position('left') 30 | ax.spines['left'].set_position(('data',0)) 31 | plt.show() 32 | plt.close() 33 | 34 | 35 | -------------------------------------------------------------------------------- /archive/Plotter.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from math import * 3 | add = 0 4 | s = str(input("Enter function : ")) #Inputs function 5 | temp = s 6 | s= s.replace('x','(x)') 7 | ctr, x, y = -10, [], [] #Setting countert to starting values and x,y to empty lists 8 | while ctr<=10: 9 | s1 = '' 10 | add = 0 11 | s1 = s.replace('x',str(ctr)) #Replaces variable with value at that point 12 | try: 13 | add = eval(s1) #Tries to evaluate function at that point, if defined 14 | y.append(add) 15 | x.append(ctr) 16 | except: 17 | pass#If beyond domain, pass 18 | ctr+=0.1 19 | #print (x) 20 | #print (y) 21 | plt.figure(num ='GPYTHON') 22 | plt.plot(x,y,label = 'y = '+temp,color = 'black') 23 | plt.xlabel('X Axis') 24 | plt.ylabel('Y Axis') 25 | #plt.title(temp.upper()) 26 | #plt.style.use('ggplot') 27 | ax = plt.gca() 28 | plt.grid(True) 29 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 30 | ax.spines['right'].set_color('none') 31 | ax.spines['top'].set_color('none') 32 | ax.xaxis.set_ticks_position('bottom') 33 | ax.spines['bottom'].set_position(('data',0)) 34 | ax.yaxis.set_ticks_position('left') 35 | ax.spines['left'].set_position(('data',0)) 36 | plt.show() 37 | plt.close() 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /archive/Polar.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import numpy as np 3 | from math import * 4 | add = 0 5 | s = str(input("Enter function : ")) 6 | temp = s 7 | rads = list(np.arange(-2*pi,2*pi,0.1)) 8 | s= s.replace('theta','(theta)') 9 | f = lambda theta:eval(s) 10 | ctr, x, y = -10*pi, [], [] 11 | fig = plt.figure(num = 'GPython') 12 | fig.add_subplot(111, projection='polar') 13 | for angle in rads: 14 | try: 15 | add = f(angle) 16 | x.append(angle) 17 | y.append(add) 18 | plt.polar(x,y) 19 | except: 20 | pass 21 | #plt.polar(x,y) 22 | plt.show() 23 | plt.close() 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /archive/Polynomial Graph.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | st= str(input("Enter an equation : ")) 3 | s = st + '+' 4 | l = len(s) 5 | a= [] 6 | n = 0 7 | beg,end = 0,0 8 | for i in range(1,l): 9 | if s[i] in ['+','-']: 10 | a.append(s[beg:i]) 11 | beg = i 12 | x,y = [],[] 13 | num = [] 14 | add = 0 15 | j = -100 16 | while j<=100: 17 | j+=0.01 18 | x.append(j) 19 | add=0 20 | for i in a: 21 | sign = i[0] 22 | xpos = i.find('x') 23 | if xpos == -1: 24 | const = float(i[1:]) 25 | if sign == '+': 26 | add+=const 27 | else: 28 | add-=const 29 | else: 30 | if i[-1].isdigit() and i[1].isdigit(): 31 | coeff = float(i[1:xpos]) 32 | fact = float(i[xpos+1:]) 33 | if sign == '+': 34 | add+=coeff*(j**fact) 35 | else: 36 | add-=coeff*(j**fact) 37 | elif i[-1].isdigit(): 38 | fact = float(i[xpos+1:]) 39 | if sign == '+': 40 | add+=(j**fact) 41 | else: 42 | add-=(j**fact) 43 | elif i[1].isdigit(): 44 | coeff = float(i[1:xpos]) 45 | if sign == '+': 46 | add+=coeff*j 47 | else: 48 | add-=coeff*j 49 | else: 50 | if sign == '+': 51 | add+=j 52 | else: 53 | add-=j 54 | y.append(add) 55 | #print (x) 56 | #print (y) 57 | plt.plot(x,y,label = st,color = 'red') 58 | #plt.xlabel('x - axis') 59 | #plt.ylabel('y - axis') 60 | #plt.title(st.upper()) 61 | ax = plt.gca() 62 | plt.grid(True) 63 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 64 | #plt.style.use('ggplot') 65 | ax.spines['right'].set_color('none') 66 | ax.spines['top'].set_color('none') 67 | ax.xaxis.set_ticks_position('bottom') 68 | ax.spines['bottom'].set_position(('data',0)) 69 | ax.yaxis.set_ticks_position('left') 70 | ax.spines['left'].set_position(('data',0)) 71 | plt.show() 72 | plt.close() 73 | -------------------------------------------------------------------------------- /archive/n-Derivative.py: -------------------------------------------------------------------------------- 1 | '''import sympy as sp 2 | x = sp.Symbol('x') 3 | a =(sp.diff(3*x**2,x)) 4 | print(type(a)) 5 | print(a)''' 6 | from scipy.misc import derivative 7 | import numpy as np 8 | from scipy import integrate 9 | import matplotlib.pyplot as plt 10 | from numpy import * 11 | from math import * 12 | X = np.arange(-10,10,1) 13 | s=input("Enter function : ") 14 | num = int(input("Enter derivative number : ")) 15 | temp = s 16 | s = s.replace('x','(x)') 17 | f = lambda x:eval(s) 18 | x,y = X,[] 19 | ctr = -10 20 | '''while ctr <=10: 21 | x.append(ctr) 22 | try: 23 | y.append(derivative(f,ctr)) 24 | except: 25 | y.append(None) 26 | ctr+=0.01''' 27 | def F(x): 28 | res = np.zeros_like(x) 29 | for i,val in enumerate(x): 30 | try: 31 | y= derivative(f,val,dx = 1,n = num,order = 3) 32 | res[i]=y 33 | except: 34 | res[i] = None 35 | return res 36 | plt.figure(num ='GPYTHON') 37 | plt.plot(x,F(x),label = temp,color = 'black') 38 | plt.xlabel('X Axis') 39 | plt.ylabel('Y Axis') 40 | plt.title("Derivative "+ str(num)+ ' of '+temp) 41 | #plt.style.use('ggplot') 42 | ax = plt.gca() 43 | plt.grid() 44 | plt.legend(bbox_to_anchor=(1.1, 1.05)) 45 | ax.spines['right'].set_color('none') 46 | ax.spines['top'].set_color('none') 47 | ax.xaxis.set_ticks_position('bottom') 48 | ax.spines['bottom'].set_position(('data',0)) 49 | ax.yaxis.set_ticks_position('left') 50 | ax.spines['left'].set_position(('data',0)) 51 | plt.show() 52 | plt.close() 53 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | matplotlib 2 | numpy -------------------------------------------------------------------------------- /src/utils.py: -------------------------------------------------------------------------------- 1 | def configureEquation(expression): 2 | lhs, rhs = list(map(str.strip, expression.split("="))) 3 | new_expression = f"{lhs} - ({rhs})" 4 | return new_expression --------------------------------------------------------------------------------