pixelator-calc 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pixelator_calc-1.0.0/PKG-INFO +29 -0
- pixelator_calc-1.0.0/README.md +19 -0
- pixelator_calc-1.0.0/calculator.py +225 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/PKG-INFO +29 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/SOURCES.txt +9 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/dependency_links.txt +1 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/entry_points.txt +2 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/requires.txt +2 -0
- pixelator_calc-1.0.0/pixelator_calc.egg-info/top_level.txt +1 -0
- pixelator_calc-1.0.0/pyproject.toml +18 -0
- pixelator_calc-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pixelator-calc
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Pixelator: a command-line calculator with trig, logs, a math quiz, and graphing
|
|
5
|
+
Author: Aadit Sarangi
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
|
|
11
|
+
# Pixelator
|
|
12
|
+
|
|
13
|
+
A command-line calculator: add/subtract, multiply/divide, trig and inverse trig, powers and roots, logarithms, a 10-question math quiz, and a graphing calculator.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pipx install pixelator-calc
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
(or `pip install pixelator-calc`)
|
|
22
|
+
|
|
23
|
+
## Run
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pixelator
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Developed by Aadit Sarangi.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Pixelator
|
|
2
|
+
|
|
3
|
+
A command-line calculator: add/subtract, multiply/divide, trig and inverse trig, powers and roots, logarithms, a 10-question math quiz, and a graphing calculator.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pipx install pixelator-calc
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
(or `pip install pixelator-calc`)
|
|
12
|
+
|
|
13
|
+
## Run
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
pixelator
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Developed by Aadit Sarangi.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import random
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def add(x, y):
|
|
6
|
+
return x + y
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def subtract(x, y):
|
|
10
|
+
return x - y
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def multiply(x, y):
|
|
14
|
+
return x * y
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def divide(x, y):
|
|
18
|
+
if y == 0:
|
|
19
|
+
raise ValueError("Cannot divide by zero.")
|
|
20
|
+
return x / y
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
print("Select operation:")
|
|
25
|
+
print("1. Add / Subtract ")
|
|
26
|
+
print("2. Multiply/Divide")
|
|
27
|
+
print("3. Trigonometric Functions / Inverse Trigonometric Functions")
|
|
28
|
+
print("4. Powers and Roots")
|
|
29
|
+
print("5. Logarithms")
|
|
30
|
+
print("6. Word Problems")
|
|
31
|
+
print("7. Beta: AI problem solver")
|
|
32
|
+
print("8. Graphing Calculator")
|
|
33
|
+
print("9. About")
|
|
34
|
+
print("Aditional features will be added in the future. Please check back later for updates.")
|
|
35
|
+
|
|
36
|
+
while True:
|
|
37
|
+
choice = input("Enter choice (1/2/3/4/5/6/7/8/9): ")
|
|
38
|
+
if choice == '1':
|
|
39
|
+
add_choice = input("Addition or Subtraction? Back? (1/2/3): ")
|
|
40
|
+
if add_choice == '1':
|
|
41
|
+
try:
|
|
42
|
+
num1 = float(input("Enter first number: "))
|
|
43
|
+
num2 = float(input("Enter second number: "))
|
|
44
|
+
print(f"{num1} + {num2} = {add(num1, num2)}")
|
|
45
|
+
except ValueError:
|
|
46
|
+
print("Invalid input. Please enter numeric values.")
|
|
47
|
+
elif add_choice == '2':
|
|
48
|
+
try:
|
|
49
|
+
num1 = float(input("Enter first number: "))
|
|
50
|
+
num2 = float(input("Enter second number: "))
|
|
51
|
+
print(f"{num1} - {num2} = {subtract(num1, num2)}")
|
|
52
|
+
except ValueError:
|
|
53
|
+
print("Invalid input. Please enter numeric values.")
|
|
54
|
+
elif add_choice == '3':
|
|
55
|
+
continue
|
|
56
|
+
if choice == '2':
|
|
57
|
+
mult_choice = input("Multiplication or Division? Back? (1/2/3): ")
|
|
58
|
+
if mult_choice == '1':
|
|
59
|
+
try:
|
|
60
|
+
num1 = float(input("Enter first number: "))
|
|
61
|
+
num2 = float(input("Enter second number: "))
|
|
62
|
+
print(f"{num1} * {num2} = {multiply(num1, num2)}")
|
|
63
|
+
except ValueError:
|
|
64
|
+
print("Invalid input. Please enter numeric values.")
|
|
65
|
+
elif mult_choice == '2':
|
|
66
|
+
try:
|
|
67
|
+
num1 = float(input("Enter first number: "))
|
|
68
|
+
num2 = float(input("Enter second number: "))
|
|
69
|
+
print(f"{num1} / {num2} = {divide(num1, num2)}")
|
|
70
|
+
except ValueError as e:
|
|
71
|
+
print(e)
|
|
72
|
+
elif mult_choice == '3':
|
|
73
|
+
continue
|
|
74
|
+
if choice == '3':
|
|
75
|
+
print("Select Trigonometric Function:")
|
|
76
|
+
print("1. Sine")
|
|
77
|
+
print("2. Cosine")
|
|
78
|
+
print("3. Tangent")
|
|
79
|
+
print("4. Cosecant")
|
|
80
|
+
print("5. Secant")
|
|
81
|
+
print("6. Cotangent")
|
|
82
|
+
print("7. Back")
|
|
83
|
+
function_choice = input("Enter choice (1/2/3/4/5/6/7): ")
|
|
84
|
+
if function_choice == '7':
|
|
85
|
+
continue
|
|
86
|
+
trig_choice = input("Do you want to calculate the function or its inverse? (1 for function, 2 for inverse): ")
|
|
87
|
+
if trig_choice == '1':
|
|
88
|
+
try:
|
|
89
|
+
angle = float(input("Enter angle in degrees: "))
|
|
90
|
+
radians = math.radians(angle)
|
|
91
|
+
if function_choice == '1':
|
|
92
|
+
print(f"Sine({angle}) = {math.sin(radians)}")
|
|
93
|
+
elif function_choice == '2':
|
|
94
|
+
print(f"Cosine({angle}) = {math.cos(radians)}")
|
|
95
|
+
elif function_choice == '3':
|
|
96
|
+
print(f"Tangent({angle}) = {math.tan(radians)}")
|
|
97
|
+
elif function_choice == '4':
|
|
98
|
+
print(f"Cosecant({angle}) = {1 / math.sin(radians)}")
|
|
99
|
+
elif function_choice == '5':
|
|
100
|
+
print(f"Secant({angle}) = {1 / math.cos(radians)}")
|
|
101
|
+
elif function_choice == '6':
|
|
102
|
+
print(f"Cotangent({angle}) = {1 / math.tan(radians)}")
|
|
103
|
+
else:
|
|
104
|
+
print("Invalid input. Please select a valid option.")
|
|
105
|
+
except ValueError:
|
|
106
|
+
print("Invalid input. Please enter numeric values.")
|
|
107
|
+
if trig_choice == '2':
|
|
108
|
+
try:
|
|
109
|
+
value = float(input("Enter value: "))
|
|
110
|
+
if function_choice == '1':
|
|
111
|
+
print(f"Arcsine({value}) = {math.degrees(math.asin(value))} degrees")
|
|
112
|
+
elif function_choice == '2':
|
|
113
|
+
print(f"Arccosine({value}) = {math.degrees(math.acos(value))} degrees")
|
|
114
|
+
elif function_choice == '3':
|
|
115
|
+
print(f"Arctangent({value}) = {math.degrees(math.atan(value))} degrees")
|
|
116
|
+
elif function_choice == '4':
|
|
117
|
+
print(f"Arccosecant({value}) = {math.degrees(math.asin(1/value))} degrees")
|
|
118
|
+
elif function_choice == '5':
|
|
119
|
+
print(f"Arcsecant({value}) = {math.degrees(math.acos(1/value))} degrees")
|
|
120
|
+
elif function_choice == '6':
|
|
121
|
+
print(f"Arccotangent({value}) = {math.degrees(math.atan(1/value))} degrees")
|
|
122
|
+
else:
|
|
123
|
+
print("Invalid input. Please select a valid option.")
|
|
124
|
+
except ValueError:
|
|
125
|
+
print("Invalid input. Please enter numeric values.")
|
|
126
|
+
if choice == '4':
|
|
127
|
+
print("Select operation:")
|
|
128
|
+
print("1. Power")
|
|
129
|
+
print("2. Root")
|
|
130
|
+
print("3. Back")
|
|
131
|
+
operation_choice = input("Enter choice (1/2/3): ")
|
|
132
|
+
if operation_choice == '1':
|
|
133
|
+
try:
|
|
134
|
+
base = input("Enter base : ")
|
|
135
|
+
value = float(input("Enter exponent: "))
|
|
136
|
+
if base == 'e':
|
|
137
|
+
print(f"e^{value} = {math.exp(value)}")
|
|
138
|
+
else:
|
|
139
|
+
print(f"{base}^{value} = {math.pow(float(base), value)}")
|
|
140
|
+
except ValueError:
|
|
141
|
+
print("Invalid input. Please enter numeric values.")
|
|
142
|
+
elif operation_choice == '2':
|
|
143
|
+
try:
|
|
144
|
+
value = float(input("Enter radicand: "))
|
|
145
|
+
root = float(input("Enter index: "))
|
|
146
|
+
print(f"{root}th root of {value} = {math.pow(value, 1/root)}")
|
|
147
|
+
except ValueError:
|
|
148
|
+
print("Invalid input. Please enter numeric values.")
|
|
149
|
+
elif operation_choice == '3':
|
|
150
|
+
continue
|
|
151
|
+
if choice == '5':
|
|
152
|
+
base_choice = input("Select base (1 for natural log, 2 for custom base, 3 for Back): ")
|
|
153
|
+
if base_choice == '3':
|
|
154
|
+
continue
|
|
155
|
+
if base_choice not in ('1', '2'):
|
|
156
|
+
print("Invalid input. Please select a valid option.")
|
|
157
|
+
continue
|
|
158
|
+
try:
|
|
159
|
+
value = float(input("Enter logarithm value: "))
|
|
160
|
+
if base_choice == '1':
|
|
161
|
+
print(f"Natural log of {value} = {math.log(value)}")
|
|
162
|
+
else:
|
|
163
|
+
custom_base = float(input("Enter custom base: "))
|
|
164
|
+
print(f"Log base {custom_base} of {value} = {math.log(value, custom_base)}")
|
|
165
|
+
except ValueError:
|
|
166
|
+
print("Invalid input. Please enter numeric values.")
|
|
167
|
+
if choice == '6':
|
|
168
|
+
score = 0
|
|
169
|
+
for i in range(10):
|
|
170
|
+
num1 = random.randint(20, 100)
|
|
171
|
+
num2 = random.randint(20, 100)
|
|
172
|
+
operation = random.choice(['+', '-', '*'])
|
|
173
|
+
if operation == '+':
|
|
174
|
+
answer = num1 + num2
|
|
175
|
+
elif operation == '-':
|
|
176
|
+
answer = num1 - num2
|
|
177
|
+
elif operation == '*':
|
|
178
|
+
answer = num1 * num2
|
|
179
|
+
user_answer = float(input(f"Question {i+1}: What is {num1} {operation} {num2}? "))
|
|
180
|
+
if user_answer == answer:
|
|
181
|
+
print("Correct!")
|
|
182
|
+
score += 1
|
|
183
|
+
else:
|
|
184
|
+
print(f"Incorrect. The correct answer is {answer}.")
|
|
185
|
+
print(f"You scored {score} out of 10.")
|
|
186
|
+
if choice == '7':
|
|
187
|
+
print("AI problem solver is currently in beta. Please check back later for updates. ")
|
|
188
|
+
ai_choice = input("Press 2 to go back to the main menu.")
|
|
189
|
+
if ai_choice == '2':
|
|
190
|
+
continue
|
|
191
|
+
if choice == '8':
|
|
192
|
+
import matplotlib.pyplot as plt
|
|
193
|
+
import numpy as np
|
|
194
|
+
|
|
195
|
+
print("Graphing Calculator")
|
|
196
|
+
print("Enter the function in terms of x (e.g., x**2, np.sin(x), etc.)")
|
|
197
|
+
print('Note: the calculator needs a bit more fine tuning, so please don\'t take it too seriously')
|
|
198
|
+
function_input = input("f(x) = (or type 2 to return to main menu): ")
|
|
199
|
+
if function_input == '2':
|
|
200
|
+
continue
|
|
201
|
+
try:
|
|
202
|
+
x = np.linspace(-10, 10, 400)
|
|
203
|
+
y = eval(function_input)
|
|
204
|
+
plt.plot(x, y)
|
|
205
|
+
plt.title(f"Graph of f(x) = {function_input}")
|
|
206
|
+
plt.xlabel("x")
|
|
207
|
+
plt.ylabel("f(x)")
|
|
208
|
+
plt.grid()
|
|
209
|
+
plt.axhline(0, color='black', linewidth=0.5, ls='--')
|
|
210
|
+
plt.axvline(0, color='black', linewidth=0.5, ls='--')
|
|
211
|
+
plt.show()
|
|
212
|
+
except Exception as e:
|
|
213
|
+
print(f"Error in graphing the function: {e}")
|
|
214
|
+
if choice == '9':
|
|
215
|
+
print("Pixelator is the start of my python journey. It is a simple caluclator in progress. I will ship this, but I will be back to make this good, and maybe build the hardware for it too. ")
|
|
216
|
+
print("Be back soon!")
|
|
217
|
+
print("Version: 1.0")
|
|
218
|
+
print("Developed by: Aadit Sarangi")
|
|
219
|
+
about_imput = input("Press 2 to go back to the main menu.")
|
|
220
|
+
if about_imput == '2':
|
|
221
|
+
continue
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if __name__ == "__main__":
|
|
225
|
+
main()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pixelator-calc
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Pixelator: a command-line calculator with trig, logs, a math quiz, and graphing
|
|
5
|
+
Author: Aadit Sarangi
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: matplotlib
|
|
10
|
+
|
|
11
|
+
# Pixelator
|
|
12
|
+
|
|
13
|
+
A command-line calculator: add/subtract, multiply/divide, trig and inverse trig, powers and roots, logarithms, a 10-question math quiz, and a graphing calculator.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pipx install pixelator-calc
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
(or `pip install pixelator-calc`)
|
|
22
|
+
|
|
23
|
+
## Run
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pixelator
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Developed by Aadit Sarangi.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
calculator.py
|
|
3
|
+
pyproject.toml
|
|
4
|
+
pixelator_calc.egg-info/PKG-INFO
|
|
5
|
+
pixelator_calc.egg-info/SOURCES.txt
|
|
6
|
+
pixelator_calc.egg-info/dependency_links.txt
|
|
7
|
+
pixelator_calc.egg-info/entry_points.txt
|
|
8
|
+
pixelator_calc.egg-info/requires.txt
|
|
9
|
+
pixelator_calc.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
calculator
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pixelator-calc"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Pixelator: a command-line calculator with trig, logs, a math quiz, and graphing"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
authors = [{ name = "Aadit Sarangi" }]
|
|
12
|
+
dependencies = ["numpy", "matplotlib"]
|
|
13
|
+
|
|
14
|
+
[project.scripts]
|
|
15
|
+
pixelator = "calculator:main"
|
|
16
|
+
|
|
17
|
+
[tool.setuptools]
|
|
18
|
+
py-modules = ["calculator"]
|