Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Quality of Life Features and Improve Several Functionalities #250

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5adf37d
Initial commit
RocketBlaster05 Mar 17, 2024
a420a68
Update README.md
jnazario17 Mar 17, 2024
a91b78d
Update README.md
LukaMSF Mar 17, 2024
378c06f
Merge pull request #1 from RocketBlaster05/codespace-glowing-space-tr…
RocketBlaster05 Mar 17, 2024
797bff2
Fixed basic input conversion to float error with GUI buttons
RocketBlaster05 Mar 18, 2024
017a1a6
Switched old unparseable input on keyboard to Ans key with previous a…
RocketBlaster05 Apr 20, 2024
f3ffcdf
Stopped gui from crashing when hitting visma button on empty text fie…
RocketBlaster05 Apr 20, 2024
de9c6ae
finished decimal rounding in step by step solution
RocketBlaster05 Apr 20, 2024
a2e9ccb
Fixed variable parsing error with rounding step by step solution
RocketBlaster05 Apr 20, 2024
e5ea4a3
updated case for when variable has no coefficient on rounding values
RocketBlaster05 Apr 20, 2024
30a707c
removed unnecessary print statements
RocketBlaster05 Apr 20, 2024
cbc5e35
Added graph button, works for expressions but not equations (at least…
WhetBoi Apr 20, 2024
8e91468
Added manual text to show user how to input matrices into gui
RocketBlaster05 Apr 20, 2024
413890f
Merge branch 'master' of https://github.com/RocketBlaster05/visma
RocketBlaster05 Apr 20, 2024
79c7b77
Update CONTRIBUTING.md
RocketBlaster05 Apr 21, 2024
caef397
Fixed parsing issue for integration/differentiation with value roundi…
RocketBlaster05 Apr 21, 2024
7bbbdce
More rounding parser error fixes
RocketBlaster05 Apr 21, 2024
432fe38
Removed unnecessary print statements
RocketBlaster05 Apr 21, 2024
b40863e
Added graph button, works for expressions but not equations (at least…
WhetBoi Apr 21, 2024
c21383c
Merge remote-tracking branch 'origin/master'
WhetBoi Apr 21, 2024
a53d17b
Fixed parser exponential rounding error :)
RocketBlaster05 Apr 21, 2024
b31a90c
Removed unnecessary print statements
RocketBlaster05 Apr 21, 2024
b41fbc9
Colors in windows!
jnazario17 Apr 21, 2024
131d16a
Merge remote-tracking branch 'origin/master'
jnazario17 Apr 21, 2024
90e0c7b
fixed visma button recoloring equation history box
RocketBlaster05 Apr 21, 2024
2e16c5d
Colors in windows!
jnazario17 Apr 21, 2024
4f101fc
messing with backgroung colors
RocketBlaster05 Apr 21, 2024
1859464
Colors in windows!
jnazario17 Apr 21, 2024
a4145bb
messed with background colors
RocketBlaster05 Apr 21, 2024
2838acd
Colors in windows!
jnazario17 Apr 21, 2024
5bbde03
Merge remote-tracking branch 'origin/master'
jnazario17 Apr 21, 2024
86d07bc
DOIASBFIEASB
WhetBoi Apr 21, 2024
ac6429a
Fixed colors n shit
WhetBoi Apr 21, 2024
c0d00a9
Added comments
RocketBlaster05 Apr 21, 2024
edaf3ac
Merge branch 'master' of https://github.com/RocketBlaster05/visma
RocketBlaster05 Apr 21, 2024
c4d0e1b
Added comments
RocketBlaster05 Apr 21, 2024
174bd10
Colors in windows!
jnazario17 Apr 22, 2024
99cfebd
Refactoring shennanigans
jnazario17 Apr 22, 2024
1cbc908
Replaced snake_case entities with camelCase entities
RocketBlaster05 Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is a brief guide on using **visma(VISualMAth)** and for making any contribu
* **Integration** - integrate a polynomial expression wrt a chosen variable
* **Differentiation** - differentiate a polynomial expression wrt a chosen variable
* **Plot** - plots an interactive 2D or 3D graph
* **Matrix Operations** - This feature will allow you to add, subtract, and multiply two matrices. Can also perform various simplifications on an individual matrix.

![visma](https://raw.githubusercontent.com/wiki/aerospaceresearch/visma/assets/demo.gif)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<h1 align="center">
visma - VISual MAth
</h1>

<!-- bruh momento -->
<!-- bruhbruhbruh -->
<h4 align="center">
A math equation solver and visualizer
</h4>
Expand Down
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def init():
class VisMa_Prompt(Cmd):
'''This inititates the main VisMa Prompt from where user may move to CLI/GUI'''

userManual = "|_________________________________________________________________________________________________|\n"\
userManual = " _________________________________________________________________________________________________ \n"\
"| gui ->> opens Visma in GUI mode. |\n"\
"| Ctrl + D ->> Closes the prompt. |\n"\
"| exit ->> Closes the prompt. |\n"\
Expand All @@ -31,6 +31,10 @@ class VisMa_Prompt(Cmd):
"|-------------------------------------------------------------------------------------------------|\n"\
"| integrate( expression , variable ) ->> Integrates the expression by the given variable. |\n"\
"| differentiate( expression , variable ) ->> Differentiates the expression by the given variable. |\n"\
"|-------------------------------------------------------------------------------------------------|\n"\
"| Matrices should be input in the following format: |\n"\
"| Single: mat_([x00 x01; x10 x11]) |\n"\
"| Double: mat_([x00 x01; x10 x11], [y00 y01; y10 y11]) |\n"\
"|_________________________________________________________________________________________________|\n"\

prompt = '>>> '
Expand Down
3 changes: 3 additions & 0 deletions tests/test_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

def test_simplify():

assert quickTest("4 + (3/(3-4)*3)", simplify) == "-5"


assert quickTest("1 + 2 - 3", simplify) == "0"
assert quickTest("1 + 2 - 4", simplify) == "-1.0"
assert quickTest("0 + 0 + 1", simplify) == "1.0"
Expand Down
98 changes: 98 additions & 0 deletions visma/functions/structure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,104 @@
import copy


def tokensToString(tokens):
"""Converts tokens to text string

Arguments:
tokens {list} -- list of function tokens

Returns:
tokenString {string} -- equation string
"""
# FIXME: tokensToString method
# tokenString = ''
# for token in tokens:
# if isinstance(token, Constant):
# if isinstance(token.value, list):
# for j, val in token.value:
# if token['power'][j] != 1:
# tokenString += (str(val) + '^(' + str(token.power[j]) + ')')
# else:
# tokenString += str(val)
# elif isNumber(token.value):
# if token.power != 1:
# tokenString += (str(token.value) + '^(' + str(token.power) + ')')
# else:
# tokenString += str(token.value)
# elif isinstance(token, Variable):
# if token.coefficient == 1:
# pass
# elif token.coefficient == -1:
# tokenString += '-'
# else:
# tokenString += str(token.coefficient)
# for j, val in enumerate(token.value):
# if token.power[j] != 1:
# tokenString += (str(val) + '^(' + str(token.power[j]) + ')')
# else:
# tokenString += str(val)
# elif isinstance(token, Binary):
# tokenString += ' ' + str(token.value) + ' '
# elif isinstance(token, Expression):
# if token.coefficient != 1:
# tokenString += str(token.coefficient) + '*'
# tokenString += '('
# tokenString += tokensToString(token.tokens)
# tokenString += ')'
# if token.power != 1:
# tokenString += '^(' + str(token.power) + ')'
# elif isinstance(token, Sqrt):
# tokenString += 'sqrt['
# if isinstance(token.power, Constant):
# tokenString += tokensToString([token.power])
# elif isinstance(token.power, Variable):
# tokenString += tokensToString([token.power])
# elif isinstance(token.power, Expression):
# tokenString += tokensToString(token.power.tokens)
# tokenString += ']('
# if isinstance(token.operand, Constant):
# tokenString += tokensToString([token.operand])
# elif isinstance(token.operand, Variable):
# tokenString += tokensToString([token.operand])
# elif isinstance(token.operand, Expression):
# tokenString += tokensToString(token.operand.tokens)
# tokenString += ')'
# elif isinstance(token, Logarithm):
# if token.coefficient == 1:
# pass
# elif token.coefficient == -1:
# tokenString += '-'
# else:
# tokenString += str(token.coefficient)
# if token.operand is not None:
# tokenString += token.value
# if token.power != 1:
# tokenString += "^" + "(" + str(token.power) + ")"
# tokenString += "(" + tokensToString([token.operand]) + ")"
# elif isinstance(token, Trigonometric):
# if token.coefficient == 1:
# pass
# elif token.coefficient == -1:
# tokenString += '-'
# else:
# tokenString += str(token.coefficient)
# if token.operand is not None:
# tokenString += token.value
# if token.power != 1:
# tokenString += "^" + "(" + str(token.power) + ")"
# tokenString += "(" + tokensToString([token.operand]) + ")"
# elif isinstance(token, Matrix):
# tokenString += "["
# for i in range(token.dim[0]):
# for j in range(token.dim[1]):
# tokenString += tokensToString(token.value[i][j])
# tokenString += ","
# tokenString = tokenString[:-1] + ";"
# tokenString = tokenString[:-1] + "]"
#
# return tokenString


class Function(object):
"""Basis function class for all functions

Expand Down
1 change: 1 addition & 0 deletions visma/gui/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QTabWidget, QVBoxLayout
from PyQt5.QtCore import Qt
from visma.calculus.differentiation import differentiate
from visma.calculus.integration import integrate
from visma.discreteMaths.combinatorics import factorial, combination, permutation
Expand Down
1 change: 1 addition & 0 deletions visma/gui/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
def logTextBox(workspace):
workspace.logBox = QTextEdit()
workspace.logBox.setReadOnly(True)
workspace.logBox.setStyleSheet("background-color: rgb(210, 210, 210)") # colors inside of logger
textLayout = QVBoxLayout()
textLayout.addWidget(workspace.logBox)
return textLayout
Expand Down
6 changes: 6 additions & 0 deletions visma/gui/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class NavigationCustomToolbar(NavigationToolbar):
layout = QVBoxLayout()
layout.addWidget(workspace.canvas2D)
layout.addWidget(workspace.toolbar2D)
workspace.figure2D.set_facecolor("none") # makes color transparent
workspace.canvas2D.setStyleSheet("background-color: rgb(210, 210, 210)")
return layout


Expand All @@ -216,6 +218,9 @@ class NavigationCustomToolbar(NavigationToolbar):
layout = QVBoxLayout()
layout.addWidget(workspace.canvas3D)
layout.addWidget(workspace.toolbar3D)
workspace.figure3D.set_facecolor("none") # makes color transparent
workspace.canvas3D.setStyleSheet("background-color: rgb(210, 210, 210)")

return layout


Expand Down Expand Up @@ -307,6 +312,7 @@ def plot(workspace, tokens=None):
renderPlot(workspace, graphVars, func, variables, tokens)



def selectAdditionalVariable(var1):
if var1 == 'z':
var2 = 'a'
Expand Down
3 changes: 1 addition & 2 deletions visma/gui/qsolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def qSolveFigure(workspace):
"""

bg = workspace.palette().window().color()
bgcolor = (bg.redF(), bg.greenF(), bg.blueF())
workspace.qSolveFigure = Figure(edgecolor=bgcolor, facecolor=bgcolor)
workspace.qSolveFigure = Figure(edgecolor="none", facecolor="none") # Make transparent so parent can override background
workspace.solcanvas = FigureCanvas(workspace.qSolveFigure)
workspace.qSolveFigure.clear()
qSolLayout = QtWidgets.QVBoxLayout()
Expand Down
4 changes: 3 additions & 1 deletion visma/gui/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ def stepsFigure(workspace):
"""
workspace.stepsfigure = Figure()
workspace.stepscanvas = FigureCanvas(workspace.stepsfigure)
workspace.stepsfigure.set_facecolor("none") # make figure transparent so that background of scrollbar is visible
workspace.stepsfigure.clear()
workspace.scroll = QScrollArea()
workspace.scroll.setWidget(workspace.stepscanvas)
workspace.scroll.setStyleSheet("background-color: rgb(210, 210, 210)") # color background of scrollbar
stepslayout = QVBoxLayout()
stepslayout.addWidget(workspace.scroll)
return stepslayout
Expand All @@ -37,7 +39,7 @@ def showSteps(workspace):
verticalalignment='top', size=qApp.font().pointSize()*workspace.stepsFontSize)
workspace.stepscanvas.draw()
hbar = workspace.scroll.horizontalScrollBar()
hbar.setValue((hbar.minimum()+hbar.maximum())/2)
hbar.setValue((hbar.minimum()+hbar.maximum())//2)


###############
Expand Down
Loading