Edit of asset "RES - Real Equation Solver" Accepted
Old/Current | New/Edit | |
---|---|---|
Title | RES - Real Equation Solver | Equation Real Solver |
Description |
Equation solver for finding real roots of equations up to 4th degree for Godot. Methods float cbrt(x: float) static float solve_linear(a: float, b: float) static Array[float] solve_quadratic(a: float, b: float, c: float) static Array[float] solve_cubic(a: float, b: float, c: float, d: float) static Array[float] solve_quartic(a: float, b: float, c: float, d: float, e: float) static Array[float] generate_linear(r1: float) static Array[float] generate_quadratic(r1: float, r2: float) static Array[float] generate_cubic(r1: float, r2: float, r3: float) static Array[float] generate_quartic(r1: float, r2: float, r3: float, r4: float) static Example func example() -> void: print(RES.cbrt(27)) # Prints 3 print(RES.solve_linear(5, -10)) # Prints 2 print(RES.solve_quadratic(1, 1, -6)) # Prints [-3, 2] print(RES.solve_cubic(2, -11, 12, 9)) # Prints [-0.5, 3] print(RES.solve_quartic(1, -10, 35, -50, 24)) # Prints [1, 2, 3, 4] print(RES.generate_quartic(1, 2, 3, 4)) # Prints [1, -10, 35, -50, 24] |
Functions on GDScript for finding real roots of polynomial equations of degree up to 4 (quartic). Usage Functions take a value of type float and return a sorted array of real roots. If there are no roots, return an empty array. Examples func example(): var roots: Array[float] = Equation.quartic_solve_real(1, -10, 35, -50, 24) print(roots) # Prints "[1, 2, 3, 4]" roots = Equation.cubic_solve_real(2, -11, 12, 9) print(roots) # Prints "[-0.5, 3]" Functions in current version linear_solve_real(a: float, b: float) -> Array[float] quadratic_solve_real(a: float, b: float, c: float) -> Array[float] cubic_solve_real(a: float, b: float, c: float, d: float) -> Array[float] quartic_solve_real(a: float, b: float, c: float, d: float, e: float) -> Array[float] Warning Arguments that are too large or small can lead to inaccurate answers. |
Category | Scripts | |
License | MIT | |
Repository Provider | GitHub | |
Repository Url | https://github.com/neclor/godot-real-equation-solver | https://github.com/neclor/equation-real-solver-godot |
Issues Url | https://github.com/neclor/real-equation-solver-godot/issues | |
Godot version | Godot 4.0 | |
Version String | 3.0.0 | |
Download Commit | efdc06defd902edc263d1a475bfdbd3e62f4e34a | ce0361751452c66222d2561f267b633ae36016e0 |
Download Url (Computed) | https://github.com/neclor/godot-real-equation-solver/archive/efdc06defd902edc263d1a475bfdbd3e62f4e34a.zip | https://github.com/neclor/equation-real-solver-godot/archive/ce0361751452c66222d2561f267b633ae36016e0.zip |
Icon Url |
https://raw.githubusercontent.com/neclor/real-equation-solver-godot/main/icon.png
![]() |
https://raw.githubusercontent.com/neclor/equation-real-solver-godot/main/docs/icon.png
![]() |