Documentation ¶
Overview ¶
The 'equationsolver' package allows to solve Linear, Quadratic and Cubic equations.
How to write an equation:
1) 'x' is the only variable you can use;
2) '^' is the symbol to indicate the powering, ex: x^3 is x powered 3.
Example:
x^3+x^2+3=3+x-2x^2 (valid)
y^2=x**2 (invalid)
If you need to report an issue go on https://github.com/Gabri432/equation-solver/issues/new
If you appreciate the work consider putting a star on https://github.com/Gabri432/equation-solver
Check its correctness with this link: https://www.calculatorsoup.com/calculators/algebra/cubicequation.php
This project is under the MIT license: https://github.com/Gabri432/equation-solver/blob/master/license
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateEquation ¶
Check if the expression given is an actual equation.
It looks for:
- the presence of the '=' equal sign
- the absence of '**' (consecutives multiplication signs)
- the absence of '^^' (consecutives powering signs)
- the absence of '//' (consecutives division signs)
- the absence of 'xx' (consecutives variable signs)
Types ¶
type EquationSolution ¶
type EquationSolution struct { RealSolutions []float64 // set of real solutions ComplexSolutions []complex128 // set of complex solutions ErrorDescription string // error message }
func EvaluateEquation ¶
func EvaluateEquation(equation string) EquationSolution
It takes the user equation and solves it.
It can only take Linear, Quadratic and Cubic equations.
It returns the set of real solutions, complex solution, and eventually an error message.
type Polynom ¶
Creates a polynom in the form: ax^3+bx^2+cx+d
func (Polynom) SolvePolynom ¶
func (p Polynom) SolvePolynom() EquationSolution
Returns polynom solutions