Quadratic Equation Solver




Cubic Equation Solver





Quartic Equation Solver






Quintic Equation Solver






packages = ['AzizKitten']
from pyscript import Element from AzizKitten import quintic, quartic, cubic, quad def quintic_process_input(event): try: a = Element("a3").element.value b = Element("b3").element.value c = Element("c3").element.value d = Element("d3").element.value e = Element("e3").element.value f = Element("f3").element.value solutions = quintic(float(a),float(b),float(c),float(d), float(e), float(f)) if float(b) >= 0: b_sign = "+" else: b = b[1::] b_sign = "-" if float(c) >= 0: c_sign = "+" else: c = c[1::] c_sign = "-" if float(d) >= 0: d_sign = "+" else: d = d[1::] d_sign = "-" if float(e) >= 0: e_sign = "+" else: e = e[1::] e_sign = "-" if float(f) >= 0: f_sign = "+" else: f = f[1::] f_sign = "-" for i in range(len(solutions)): if type(solutions[i]) is complex: quintic_output = f"{a}x⁵ {b_sign} {b}x⁴ {c_sign} {c}x³ {d_sign} {d}x² {e_sign} {e}x {f_sign} {f} = 0
S = {solutions}" break else: quintic_output = f"{a}x⁵ {b_sign} {b}x⁴ {c_sign} {c}x³ {d_sign} {d}x² {e_sign} {e}x {f_sign} {f} = 0
S = {solutions}" except: quintic_output = "Please enter valid numbers." Element("quintic-output").element.innerHTML = quintic_output def quartic_process_input(event): try: a = Element("a2").element.value b = Element("b2").element.value c = Element("c2").element.value d = Element("d2").element.value e = Element("e2").element.value solutions = quartic(float(a),float(b),float(c),float(d), float(e)) if float(b) >= 0: b_sign = "+" else: b = b[1::] b_sign = "-" if float(c) >= 0: c_sign = "+" else: c = c[1::] c_sign = "-" if float(d) >= 0: d_sign = "+" else: d = d[1::] d_sign = "-" if float(e) >= 0: e_sign = "+" else: e = e[1::] e_sign = "-" for i in range(len(solutions)): if type(solutions[i]) is complex: quartic_output = f"{a}x⁴ {b_sign} {b}x³ {c_sign} {c}x² {d_sign} {d}x {e_sign} {e} = 0
S = {solutions}" break else: quartic_output = f"{a}x⁴ {b_sign} {b}x³ {c_sign} {c}x² {d_sign} {d}x {e_sign} {e} = 0
S = {solutions}" except: quartic_output = "Please enter valid numbers." Element("quartic-output").element.innerHTML = quartic_output def cubic_process_input(event): try: a = Element("a").element.value b = Element("b").element.value c = Element("c").element.value d = Element("d").element.value solutions = cubic(float(a),float(b),float(c),float(d)) if float(b) >= 0: b_sign = "+" else: b = b[1::] b_sign = "-" if float(c) >= 0: c_sign = "+" else: c = c[1::] c_sign = "-" if float(d) >= 0: d_sign = "+" else: d = d[1::] d_sign = "-" for i in range(len(solutions)): if type(solutions[i]) is complex: cubic_output = f"{a}x³ {b_sign} {b}x² {c_sign} {c}x {d_sign} {d} = 0
S = {solutions}" break else: cubic_output = f"{a}x³ {b_sign} {b}x² {c_sign} {c}x {d_sign} {d} = 0
S = {solutions}" except: cubic_output = "Please enter valid numbers." Element("cubic-output").element.innerHTML = cubic_output def quad_process_input(event): try: a = Element("a1").element.value b = Element("b1").element.value c = Element("c1").element.value solutions = quad(float(a),float(b),float(c)) if float(b) >= 0: b_sign = "+" else: b = b[1::] b_sign = "-" if float(c) >= 0: c_sign = "+" else: c = c[1::] c_sign = "-" for i in range(len(solutions)): if type(solutions[i]) is complex: quad_output = f"{a}x² {b_sign} {b}x {c_sign} {c} = 0
S = {solutions}" break else: quad_output = f"{a}x² {b_sign} {b}x {c_sign} {c} = 0
S = {solutions}" except: quad_output = "Please enter valid numbers." Element("quad-output").element.innerHTML = quad_output Element("submit-quad").element.onclick = quad_process_input Element("submit-cubic").element.onclick = cubic_process_input Element("submit-quartic").element.onclick = quartic_process_input Element("submit-quintic").element.onclick = quintic_process_input