spagestic commited on
Commit
f6cc900
·
1 Parent(s): 7d283c3

feat: enhance Gradio interfaces for cubic, polynomial, quadratic, and simultaneous equation solvers with detailed descriptions and examples

Browse files
maths/equations/solve_cubic.py CHANGED
@@ -42,5 +42,16 @@ cubic_solver_interface = gr.Interface(
42
  ],
43
  outputs="text",
44
  title="Cubic Equation Solver",
45
- description="Solve ax³ + bx² + cx + d = 0"
 
 
 
 
 
 
 
 
 
 
 
46
  )
 
42
  ],
43
  outputs="text",
44
  title="Cubic Equation Solver",
45
+ description="""
46
+ Solve cubic equations of the form ax³ + bx² + cx + d = 0. Enter the coefficients for your cubic equation.
47
+
48
+ Example: For x³ - 6x² + 11x - 6 = 0, enter a=1, b=-6, c=11, d=-6.
49
+
50
+ Returns all real and complex roots.
51
+ """,
52
+ examples=[
53
+ [1, -6, 11, -6],
54
+ [2, 0, -4, 2],
55
+ [1, 0, 0, -8]
56
+ ]
57
  )
maths/equations/solve_poly.py CHANGED
@@ -37,5 +37,16 @@ poly_solver_interface = gr.Interface(
37
  inputs=gr.Textbox(label="Coefficients (comma-separated, highest degree first)", placeholder="e.g. 1, 0, -2, -8"),
38
  outputs="text",
39
  title="Polynomial Equation Solver",
40
- description="Find roots of any polynomial. Enter coefficients separated by commas (highest degree first)."
 
 
 
 
 
 
 
 
 
 
 
41
  )
 
37
  inputs=gr.Textbox(label="Coefficients (comma-separated, highest degree first)", placeholder="e.g. 1, 0, -2, -8"),
38
  outputs="text",
39
  title="Polynomial Equation Solver",
40
+ description="""
41
+ Find roots of any polynomial equation. Enter the coefficients separated by commas, starting with the highest degree.
42
+
43
+ Example: For x⁴ - 2x² - 8 = 0, enter: 1, 0, -2, 0, -8
44
+
45
+ Supports real and complex roots for polynomials of any degree.
46
+ """,
47
+ examples=[
48
+ ["1, 0, -2, 0, -8"],
49
+ ["2, -3, 0, 1"],
50
+ ["1, -6, 11, -6"]
51
+ ]
52
  )
maths/equations/solve_quadratic.py CHANGED
@@ -104,7 +104,21 @@ solve_quadratic_interface = gr.Interface(
104
  ],
105
  outputs="text",
106
  title="Quadratic Equation Solver",
107
- description="Solve ax² + bx + c = 0 and find vertex"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  )
109
 
110
  def plot_quadratic(a, b, c):
@@ -178,5 +192,14 @@ quadratic_visualizer_interface = gr.Interface(
178
  ],
179
  outputs=gr.Plot(),
180
  title="Quadratic Function Visualizer",
181
- description="Visualize the graph of a quadratic function f(x) = ax² + bx + c with its vertex and roots"
 
 
 
 
 
 
 
 
 
182
  )
 
104
  ],
105
  outputs="text",
106
  title="Quadratic Equation Solver",
107
+ description="""
108
+ Solve ax² + bx + c = 0 and find the vertex. Enter the coefficients for your quadratic equation and select the output format.
109
+
110
+ Example: For x² - 3x + 2 = 0, enter a=1, b=-3, c=2.
111
+
112
+ Output format:
113
+ - 'string': plain text
114
+ - 'dict': formatted output
115
+ - 'surd': exact roots (if possible)
116
+ """,
117
+ examples=[
118
+ [1, -3, 2, "dict"],
119
+ [2, 4, -6, "string"],
120
+ [1, 2, 1, "surd"]
121
+ ]
122
  )
123
 
124
  def plot_quadratic(a, b, c):
 
192
  ],
193
  outputs=gr.Plot(),
194
  title="Quadratic Function Visualizer",
195
+ description="""
196
+ Visualize the graph of a quadratic function f(x) = ax² + bx + c, including its vertex and real roots (if any).
197
+
198
+ Example: For f(x) = x² - 4x + 3, enter a=1, b=-4, c=3.
199
+ """,
200
+ examples=[
201
+ [1, -4, 3],
202
+ [2, 0, -8],
203
+ [1, 2, 1]
204
+ ]
205
  )
maths/equations/solve_simultaneous.py CHANGED
@@ -31,5 +31,12 @@ simultaneous_solver_interface = gr.Interface(
31
  ],
32
  outputs="text",
33
  title="Simultaneous Linear Equation Solver",
34
- description="Solve simultaneous linear equations. Enter coefficients for each equation (one per line), and constants."
 
 
 
 
 
 
 
35
  )
 
31
  ],
32
  outputs="text",
33
  title="Simultaneous Linear Equation Solver",
34
+ description="""
35
+ Solve systems of simultaneous linear equations. Enter the coefficients for each equation (one per line, comma-separated) and the constants (right-hand side values).\n\nExample: For the system\n\n x + 2y = 5\n 3x + 4y = 6\n\nEnter coefficients:\n1,2\n3,4\n\nEnter constants:\n5,6
36
+ """,
37
+ examples=[
38
+ ["1,2\n3,4", "5,6"],
39
+ ["2,1\n1,3", "8,13"],
40
+ ["1,1,1\n2,3,4\n1,2,3", "6,20,14"]
41
+ ]
42
  )