-
Notifications
You must be signed in to change notification settings - Fork 0
/
Seiling math solver.py
513 lines (480 loc) · 14.9 KB
/
Seiling math solver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
pi = 3.1415
import math
import time
# This will help navigate back to start
def ynrspble():
print("Would you like to go back to start? Y/N")
yorn = input()
if yorn.lower() == "y":
problemlist()
else:
if yorn.lower() == "n":
print("Thank you for using Seiling math solver v" + varversionofsolver)
else:
print("Syntax error please try again")
ynrspble()
# what this can calculate
def problemlist():
print("[1] Programing credits")
print("[2] Y = MX + B")
print("[3] Slope")
print("[4] y intercept from table")
print("[5] x intercept from table")
print("[6] Two step equations")
print("[7] Slope To standard form")
print("[8] Transformations")
print('[9] Fraction to decimal')
print('[10] Roots')
print('[11] Area and Volume')
print('[12] Pythagorean Theorem')
print('Select what you would like to use')
cmd = input()
if cmd == '1':
procred()
elif cmd == '2':
yemxpb()
elif cmd == '3':
slope()
elif cmd == '4':
Ytab()
elif cmd == '5':
Xtab()
elif cmd == '6':
PreAl()
elif cmd == '7':
SS()
elif cmd == '8':
transformations()
elif cmd == '9':
fraction_to_decimal()
elif cmd == '10':
nav_for_roots()
elif cmd == '11':
area_and_volume_nav()
elif cmd == '12':
pythagorean_theorem()
# Programing credits
def procred():
print('© 2020 Seiling Enterprises')
ynrspble()
#Y=mx+B
def yemxpb():
ymxb = float(input("Input B "))
ymxm = float(input("Input M/slope decimal please "))
ymxx = float(input("Input X "))
ymxbc = (ymxm * ymxx) + ymxb
print("The answer is " + str(ymxbc))
ynrspble()
# slope
def slope():
y1 = float(input("what is your y1? "))
y2 = float(input("what is your y2? "))
x1 = float(input("what is your x1? "))
x2 = float(input("what is your x2? "))
s1 = y2 - y1
s2 = x2 - x1
s3 = s1 / s2
print(s3)
ynrspble()
# y from a table
def Ytab():
tbx = float(input("Input X "))
tbs = float(input("Input slope (Decimal please) "))
yft1 = tbx * tbs
yft2 = tbx - yft1
print("y-intercept= " + str(yft2))
ynrspble()
#x from a table
def Xtab():
tby = float(input("Input y "))
tbs = float(input("Input slope (Decimal)"))
xft1 = tby * tbs
xft2 = xft1 - tby
print("x-intercept= " + str(xft2))
ynrspble()
# this helps decide what pre al function to use
def PreAl():
print("[1] Addition")
print("[2] Subtraction")
cmd = input()
if cmd == '1':
Add()
elif cmd == '2':
Sub()
# two step equations
def Add():
preax = float(input("Input Coefficient (No fractions only decimal) "))
nmtet = float(input("Input number that equation is equal to" ))
ipctvar = float(input("Input Constant" ))
prealcal1 = nmtet - ipctvar
prealcal2 = prealcal1 / preax
print("Your answer is: " + str(prealcal2))
ynrspble()
def Sub():
print("Input Coefficient (No fractions only decimal)")
preax = float(input())
print("Input number that equation is equal to")
nmtet = float(input())
print("Input Constant")
ipctvar = float(input())
prealcal1 = nmtet + ipctvar
prealcal2 = prealcal1 / preax
print("Your awnser is: " + str(prealcal2))
ynrspble()
#slope to standard form
def SS():
print("Y = A/Bx + b --> Ax + By = C")
time.sleep(1)
y = float(input("enter y value "))
A = float(input("enter M as fraction A/B - A "))
B = float(input("enter M as fraction A/B - B "))
b = float(input("enter b "))
ys = str(y)
As = str(A)
Bs = str(B)
bs = str(b)
print("equation: "+ys+"y = " + As + "/" + Bs + "x + " + bs)
time.sleep(1)
print("\n-----------------\n")
time.sleep(1)
print("equation: -"+As+"/"+Bs+"x + "+ys+"y = "+bs)
time.sleep(1)
print("\n-----------------\n")
time.sleep(1)
ys1 = str(y*B)
bs1 = str(b*B)
print("final equation: -"+As+"x + "+ys1+"y = "+bs1)
time.sleep(2)
print("\n-----------------\n")
time.sleep(2)
ynrspble()
# Trasformations
def transformations():
print("What transformation would you like to preform")
print("[1] Reflections")
print("[2] Translations")
print("[3] Dilations")
print("[4] Rotations")
rtdr = input()
if rtdr == "1":
refleactions()
elif rtdr == "2":
translations()
elif rtdr == "3":
dialations()
elif rtdr == "4":
rotaions()
def translations():
print("Translations")
print("Input X cordnate")
xcor = float(input())
print("Input Y cordnate")
ycor = float(input())
print("Input Horizontal shift")
hshift = float(input())
print("Input Vertical shift")
vshift = float(input())
yshiftcal = ycor + vshift
xshiftcal = xcor + hshift
xstrcon = str(xshiftcal)
ystrcon = str(yshiftcal)
print("Your cordnets are: ( " + xstrcon + ", " + ystrcon + " )")
ynrspble()
def dialations():
print("Dilations")
print("Input X cordnet")
xcor = float(input())
print("Input Y cordnet")
ycor = float(input())
print("Input Dilation factor in decimal")
dxyfactor = float(input())
calx1 = xcor * dxyfactor
caly2 = ycor * dxyfactor
calxstrcon = str(calx1)
calystrcon = str(caly2)
print("Your awnswer is: (" + calxstrcon + ", " + calystrcon + ")")
ynrspble()
def rotaions():
print("Rotations")
print("Input X cordnate")
xcor = float(input())
print("Input Y cordnate")
ycor = float(input())
print("Input CLOCKWISE rotation (90, 180, 270)")
rot = input()
if rot == "90":
cal1 = xcor * -1
calstrx = str(cal1)
calstry = str(ycor)
print("The answer is: (" + calstry + ", " + calstrx + ")")
ynrspble()
elif rot == "180":
cal1 = xcor * -1
cal2 = ycor * -1
calstrx = str(cal1)
calstry = str(cal2)
print("The answer is: (" + calstrx + ", " + calstry + ")")
ynrspble()
elif rot == "270":
cal2 = ycor * -1
calstrx = str(xcor)
calstry = str(cal2)
print("The answer is: (" + calstry + ", " + calstrx + ")")
ynrspble()
def refleactions():
print("What would you like to reflect across")
print("[1] X axis")
print("[2] Y axis")
print("[3] Y = X")
print("[4] Y = -X")
xory = input()
if xory == "1":
print("Input X cordnet")
xcor = float(input())
print("Input Y cordnet")
ycor = float(input())
varcal2 = ycor * -1
finalcal1 = str(xcor)
finalcal2 = str(varcal2)
print("The awnser is: ( " + finalcal1 + ", " + finalcal2 + ")")
ynrspble()
elif xory == "2":
print("Input X cordnet")
xcor = float(input())
print("Input Y cordnet")
ycor = float(input())
varcal2 = xcor * -1
finalcal1 = str(ycor)
finalcal2 = str(varcal2)
print("The awnser is: ( " + finalcal2 + ", " + finalcal1 + ")")
ynrspble()
elif xory == "3":
print("Input X cordnet")
xcor = float(input())
print("Input Y cordnet")
ycor = float(input())
finalcal1 = str(ycor)
finalcal2 = str(xcor)
print("The awnser is: ( " + finalcal1 + ", " + finalcal2 + ")")
ynrspble()
elif xcor == "4":
print("Rotations")
print("Input X cordnate")
xcor = float(input())
print("Input Y cordnate")
ycor = float(input())
print("Input CLOCKWISE rotation (90, 180, 270)")
rot = input()
if rot == "90":
cal1 = xcor * -1
calstrx = str(cal1)
calstry = str(ycor)
print("The answer is: (" + calstry + ", " + calstrx + ")")
ynrspble()
elif rot == "180":
cal1 = xcor * -1
cal2 = ycor * -1
calstrx = str(cal1)
calstry = str(cal2)
print("The answer is: (" + calstrx + ", " + calstry + ")")
ynrspble()
elif rot == "270":
cal2 = ycor * -1
calstrx = str(xcor)
calstry = str(cal2)
print("The answer is: (" + calstry + ", " + calstrx + ")")
ynrspble()
#Converts Fractions to decimal
def fraction_to_decimal():
print('Fracton to decimal converter')
print('Input the numerator in interger form (Top part of the fraction)')
varnumfractodec = int(input())
print('input demonimator in Intager form (Bottom of the fraction)')
vardemfractonecdem = int(input())
varcal1 = varnumfractodec / vardemfractonecdem
varprint = str(varcal1)
if varcal1 < 1:
varprint = str(varcal1) + '0'
print('Your awnswer is ' + varprint)
ynrspble()
#Square roots
def square_roots():
print('Input number you want to square')
varnumtosquare = float(input())
varsquarerootcal1 = varnumtosquare ** 2
print('your awnswer is ' + str(varsquarerootcal1))
ynrspble()
#cube roots
def cube_roots():
print('Input number you want to cube')
varnumtocube = float(input())
varcuberootcal1 = varnumtocube ** 3
print('your awnswer is ' + str(varcuberootcal1))
ynrspble()
#Anything else to power
def to_the_power():
print('Input base number')
varbasenumber = float(input())
print('Input what woy would like to multiply it by a power to')
vartoapower = float(input())
varcaltoapower1 = varbasenumber ** vartoapower
print('your awnswer is ' + str(varcaltoapower1))
#navigaton for roots
def nav_for_roots():
print('[1] Square roots')
print('[2] Cube roots')
print('[3] Other')
print('[4] Back to start')
varselectrootnav = input()
if varselectrootnav == '1':
square_roots()
elif varselectrootnav == '2':
cube_roots()
elif varselectrootnav == '3':
to_the_power()
elif varselectrootnav == '4':
ynrspble()
# Navigaton volume and area
def area_and_volume_nav():
print('[1] Area')
print('[2] Volume')
print('[3] Exit')
var_aavn = input()
if var_aavn == '1':
nav_area()
elif var_aavn == '2':
nav_volume()
elif var_aavn == '3':
ynrspble()
# Navigaton Volume
def nav_volume():
print('[1] Cones')
print('[2] Cubes')
print('[3] Spheres')
print('[4] Cylinder')
print('[5] Triangular prism')
var_navv = input()
if var_navv == '1':
volume_of_cones()
elif var_navv == '2':
volume_of_cubes()
elif var_navv == '3':
volume_of_spheres
elif var_navv == '4':
volume_of_cylienders()
elif var_navv == '5':
volume_of_tri_prism()
# Navigaton Area
def nav_area():
print('[1] Area of a circle')
print('[2] Area of a rectangle(or cube)')
print('[3] Area of a triangle')
areainputnav = input()
if areainputnav == '1':
area_of_a_circle()
elif areainputnav == '2':
area_of_square()
elif areainputnav == '3':
area_of_triangle()
# Volume of cones
def volume_of_cones():
print('Input unit')
varconevoluni = input()
print('Input radius')
varinradcone = float(input())
print('Input hight')
varnhighcon = float(input())
varcal1 = (((varinradcone ** 2) * pi) * varnhighcon) * 1/3
print('Your awnswer is ' + str(varcal1) + ' Cubic ' + varconevoluni)
ynrspble()
# Volume of Cyinders
def volume_of_cylienders():
print('Input unit')
var_ciluninit = input()
print('Input radius')
var_radcil = float(input())
print('Input hight')
var_highcil = float(input())
varcalcil1 = ((((var_radcil ** 2) * pi)) * var_highcil)
print('Your awnswer is ' + str(varcalcil1) + ' Cubic ' + str(var_ciluninit))
ynrspble()
# Volume of cubes
def volume_of_cubes():
print('Input unit')
varcubeunit = input()
print('Input legth of side 1')
varcubeside1leg = float(input())
print('Input legth of side 2')
varcubeside2leg = float(input())
print('Input hight')
varcubehight = float(input())
varcalcubevol1 = (varcubeside1leg* varcubeside2leg) * varcubehight
print('Your awnswer is ' + str(varcalcubevol1) + ' Cubic ' + str(varcubeunit))
ynrspble()
# Volume of spheres
def volume_of_spheres():
print('Input unit')
var_sphereunitinput = input()
print('Input radius')
var_radsphereinput = float(input())
var_spherecal1 = (((var_radsphereinput ** 3) * pi) * 4/3)
print('Your Answer is ' + str(var_spherecal1) + ' Cubic ' + var_sphereunitinput)
ynrspble()
#Volume of a triangular prism
def volume_of_tri_prism():
print('Input unit')
var_unitri = input()
print('Input legth')
var_trilegth = float(input())
print('Input hight of triangle')
var_tritrihigh = float(input())
print('Input Triangle base')
var_tritribase = float(input())
var_caltrivol1 = ((var_tritrihigh * var_tritribase) * var_trilegth) * 1/2
print('Your answer is ' + str(var_caltrivol1) + ' cubic ' + var_unitri)
ynrspble()
# Area of a square
def area_of_square():
print('Input unit')
var_areasquareuni = input()
print('Input Hight of square')
var_highsquarearea = float(input())
print('Input Width of square')
var_squarewidth = float(input())
var_squareareacal1 = var_highsquarearea * var_squarewidth
print('Your awnswer is ' + str(var_squareareacal1) + ' ' + var_areasquareuni + ' Squared')
ynrspble()
# Area of a triangle calculator
def area_of_triangle():
print('Input unit')
var_unitareatri = input()
print('Input triangle hight')
var_triareahigh = float(input())
print('Input triangle base')
var_tribasearea = float(input())
var_caltriarea1 = (var_triareahigh * var_tribasearea) * 1/2
print('Your answer is ' + str(var_caltriarea1) + ' ' + var_unitareatri + ' squared')
ynrspble()
# area of a circle
def area_of_a_circle():
print('Input unit')
var_unicirin = input()
print('Input Radius')
var_radcirin = float(input())
var_calcirc1 = (var_radcirin ** 2) * pi
print('The answer is ' + str(var_calcirc1) + ' ' + var_unicirin + ' squared')
ynrspble()
# Calculates Pythagorean Theorem
def pythagorean_theorem():
print('Input A')
var_apainput = float(input())
print('Input B')
var_bpainput = float(input())
var_calpa1 = (var_apainput ** 2) + (var_bpainput ** 2)
var_rootpa = math.sqrt(var_calpa1)
print('Your awnswer is ' + str(var_rootpa))
ynrspble()
if __name__ == "__main__":
varversionofsolver = "1.0 Beta"
print("Seiling Enterprises 8th grade math solver v " + varversionofsolver)
problemlist()