forked from Xrysnow/lstgx_Math
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXEquation.h
More file actions
24 lines (22 loc) · 740 Bytes
/
XEquation.h
File metadata and controls
24 lines (22 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include <array>
#include "XComplex.h"
namespace xmath
{
namespace equation
{
/** solve:
* a1 x + b1 y = c1
* a2 x + b2 y = c2 */
std::array<double, 2> SolveLiner(
double a1, double b1, double c1,
double a2, double b2, double c2);
// solve: a x^2 + b x + c = 0
std::array<Complex, 2> SolveQuadratic(double a, double b, double c);
// solve: a x^3 + b x^2 + c x + d = 0, Shengjin method
std::array<Complex, 3> SolveCubic(double a, double b, double c, double d);
std::array<Complex, 3> SolveCubic2(double a, double b, double c, double d);
// solve: a x^4 + b x^3 + c x^2 + d x + e = 0, Ferrari method
std::array<Complex, 4> SolveQuartic(double a, double b, double c, double d, double e);
}
}