1. When entering data, any mixed input of decimals, integers, and fractions is allowed. Chinese commas, English commas, spaces, and carriage returns can be used as separators, and spaces can be used without restrictions. For example, the following input is also legal:
0.2 0.3 0.2,0.5 , 1/2 2 0.5,3 2/7
2. Please enter a legal score. Only scores in the form: 1/2, -1/2 can be recognized, but not in the form -1/-2, 1/-2 (-1)/(-2)- 1/(-2) and so on are obviously not in the form of scores written by carbon-based bioenergy;
3. Do not end with any symbols other than spaces. There is no need to add a semicolon or period after the data is input;
4. The data you enter will be treated as decimals, even if all your inputs are fractions;
5. The calculation results have been processed in this way: the final result retains four decimal places, and the extra 0 is removed;
6. Please ensure that the number of data in each group of data entered is the same;
7. When using equal weight is selected, the weight value you enter will not participate in the calculation. If you do not select equal weight, please enter the weight data with the same length and the number of data points;
8. The result of polynomial fitting will not be displayed without entering the number of polynomial fitting (must be an integer);
9. Please ensure that the base of the value before conversion is correct, currently only supports conversion between unsigned integers (that is, positive numbers);
10. The calculation result of the program may be slightly different from the answer in your reference book. This should be a matter of accuracy. The program uses double to calculate the result, and the written calculation will not use such high precision. If there is an extreme error situation, please keep the screenshot and contact us. The contact information is in the upper right corner of the homepage. Thank you for your feedback.
2. Polynomial interpolation:
Generally, we think that a coefficient vector can uniquely represent a univariate polynomial. In particular, a set of data points with a length of n+1 can also uniquely represent a univariate polynomial of degree n under certain conditions.
Let the polynomial be
By substituting the data points, n+1 equations can be obtained, and then the augmented matrix corresponding to the equations can be obtained. When the coefficient matrix is not singular (the determinant is not 0), the unique solution a can be obtained, and then the Polynomial.
3. Lagrangian interpolation:
The basic principle of Lagrange interpolation is not described. The Lagrange interpolation formula is given below:
In the formula, xi and yi are data points, and x is the point to be interpolated.
Obviously, the computational complexity of the method of solving the interpolation polynomial using the Lagrangian interpolation formula is much smaller than the complexity of the polynomial interpolation (solving linear equations).
4. Polynomial fitting:
The goal of fitting: According to the data points (xi, yi) and the weighting coefficient wi (i = 1,2,,,n) of the given point, select the approximate function form, that is, for the point function class H, find the function φ(x )∈H, such that
In the formula, S is the residual.
Minimum, this is the least squares method of data fitting, the function (x, θ) obtained is called the least square solution of this set of data, usually H is some relatively simple function set, such as low-order polynomial, exponential function Wait.
In particular, when wi = 1 (i = 1,2,,,n), this is called the natural weight coefficient. Generally, unless otherwise specified, the weight of the data is taken as the natural weight coefficient. In this APP, do not enter Weight, the natural weight coefficient is adopted by default.
Generally, let the point data group (xi,yi)(i = 1,2,,,n),φ0(x),φ1(x),,,φm(x) be a known set of [a, b] The linearly independent function group, select the approximate function as
φ(x)∈ H = span{φ0(x),φ1(x),,,φm(x)},so,
φ(x) = a0φ0(x) + a1φ1(x) +...+ amφm(x)
//a is the undetermined coefficient
For example, when fitting a straight line,make φ0(x) = 1,φ1(x) = x ;
so,φ(x) = a0 + a1 * x;
Then, the original problem is transformed into finding a multivariate function
Minimum problem
From the necessary condition of the extreme value of the multivariate function,
That is, the system of regular equations is:
Solve this system of equations to get a, and then get the polynomial
5. Exponential fitting:
If the distribution of data points approximates an exponential curve, then an exponential function can be considered
To fit the data, according to the principle of least squares, the selection of a and b should be such that
Is the smallest. But the regular equation system derived from this is a nonlinear equation system with parameters a and b, which is called the nonlinear lowest square problem. This kind of problem is more difficult to solve, so we take the natural logarithm at both ends ,Have
At this time, the nonlinear fitting problem to the data set (x, y) can be transformed into the linear fitting problem to the data set (x, Iny).
6. Base conversion:
There are generally two calculation methods for base conversion:
1. Divide by B in A base
Input: the A base of a positive integer n represents n = (ak......a1a0)A
Output: the B-ary representation of n
(1) Let the B system of n be expressed as(bt......b1b0)B
(2) Calculate in sequence under A base
(3) return (bt....b1b0)B
2. Multiply AB by base B
Input: the A base of a positive integer n represents n = (ak...a1a0)A
1. Let B integer x = 0
2. Calculate x = Ax + ak in sequence under B base, k from s to 0
3.return x
Note: When the converted number n is long, the base conversion should be performed in sections. Take the conversion algorithm of "divide by B in base A" (the first algorithm) as an example, set the number to be converted to n, Divide n by Bxy repeatedly to get the By hexadecimal representation of n, and then divide each digit in the Bxy hexadecimal representation of n repeatedly by B to convert m into a Bx hexadecimal number. The advantage of this is that the division by xB in the second step is generally only a single-precision operation, so the calculation time is greatly saved.
----This calculation method is taken from "Mathematical Principles of Computer Algebra System"