Math-Algorithms
πΊπΈ Math library with algorithms for c++
π·πΊ ΠΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠ° Ρ++ Ρ ΠΌΠ°ΡΠ΅ΠΌΠ°ΡΠΈΡΠ΅ΡΠΊΠΈΠΌΠΈ Π°Π»Π³ΠΎΡΠΈΡΠΌΠ°ΠΌΠΈ
πΊπΈ Attention!!! Any function should be used with namespace mathAlgo::
π·πΊ ΠΠ½ΠΈΠΌΠ°Π½ΠΈΠ΅!!! ΠΡΠ±ΡΡ ΡΡΠ½ΠΊΡΠΈΡ Π½ΡΠΆΠ½ΠΎ Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ Ρ ΠΏΡΠΎΡΡΡΠ°Π½ΡΡΠ²ΠΎΠΌ ΠΈΠΌΡΠ½ mathAlgo::
πΊπΈ Navigation:
- Simple arithmetic
- Arithmetic and geometric progressions
- Probability Theory and Combinatorics
- Factorial
- Probability
- Placement (order is important)
- Combination (order is NOT important)
- Bernoulli formula
- Local Phi number
- The Phi number for the Laplace integral formula
- The finite part of the function for the number of the Laplace integral formula
- Laplaceβs local theorem
- Laplace integral theorem
- Dispersion
- Standard deviation of the variance from a random variable
- Numerical methods for solving nonlinear equations
- Recursive algorithms
- Geometry
- Working with arrays and matrices
- Finding the minimum value in an array
- Finding the maximum value in an array
- Sorting an array using the bubble method
- The average value of the array
- The mode of the array
- The median of the array
- Summing two arrays
- The difference between the two arrays
- Multiplying two arrays
- Dividing two arrays
- Adding a number to all elements of an array
- Subtracting a number from all elements of an array
- Multiplying all elements of the array by a number
- Dividing all elements of an array by a number
- Array elements to a power
- Array element module
- Changing signs before elements in an array
- Filling an array with random elements
- Combining two arrays into one large one
- Combining two matrices (sum)
- Combining two matrices (difference)
- The union of two matrices (multiplication)
- Combining two matrices (division)
- Adding a number to all matrix elements
- Subtracting a number from all matrix elements
- Multiplying a number by all matrix elements
- Dividing all matrix elements by a number
- Expanding matrix elements
- Module of matrix elements
- Changing signs before numbers in the matrix
- Filling a matrix with random elements
π·πΊ ΠΠ°Π²ΠΈΠ³Π°ΡΠΈΡ:
- ΠΡΠΎΡΡΠ°Ρ Π°ΡΠΈΡΠΌΠ΅ΡΠΈΠΊΠ°
- ΠΡΠΈΡΠΌΠ΅ΡΠΈΡΠ΅ΡΠΊΠ°Ρ ΠΈ Π³Π΅ΠΎΠΌΠ΅ΡΡΠΈΡΠ΅ΡΠΊΠ°Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
- Π’Π΅ΠΎΡΠΈΡ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΠΈ ΠΈ ΠΊΠΎΠΌΠ±ΠΈΠ½Π°ΡΠΎΡΠΈΠΊΠ°
- Π€Π°ΠΊΡΠΎΡΠΈΠ°Π»
- ΠΠ΅ΡΠΎΡΡΠ½ΠΎΡΡΡ
- Π Π°Π·ΠΌΠ΅ΡΠ΅Π½ΠΈΠ΅ (ΠΏΠΎΡΡΠ΄ΠΎΠΊ Π²Π°ΠΆΠ΅Π½)
- Π‘ΠΎΡΠ΅ΡΠ°Π½ΠΈΠ΅ (ΠΏΠΎΡΡΠ΄ΠΎΠΊ ΠΠ Π²Π°ΠΆΠ΅Π½)
- Π€ΠΎΡΠΌΡΠ»Π° ΠΠ΅ΡΠ½ΡΠ»Π»ΠΈ
- ΠΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ Π€ΠΈ
- Π§ΠΈΡΠ»ΠΎ Π€ΠΈ Π΄Π»Ρ ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Ρ ΠΠ°ΠΏΠ»Π°ΡΠ°
- ΠΠΎΠ½Π΅ΡΠ½Π°Ρ ΡΠ°ΡΡΡ ΡΡΠ½ΠΊΡΠΈΠΈ Π΄Π»Ρ ΡΠΈΡΠ»Π° ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Ρ ΠΠ°ΠΏΠ»Π°ΡΠ°
- ΠΠΎΠΊΠ°Π»ΡΠ½Π°Ρ ΡΠ΅ΠΎΡΠ΅ΠΌΠ° ΠΠ°ΠΏΠ»Π°ΡΠ°
- ΠΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½Π°Ρ ΡΠ΅ΠΎΡΠ΅ΠΌΠ° ΠΠ°ΠΏΠ»Π°ΡΠ°
- ΠΠΈΡΠΏΠ΅ΡΡΠΈΡ
- Π‘ΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠ΅ ΠΎΡΠΊΠ»ΠΎΠ½Π΅Π½ΠΈΠ΅ Π΄ΠΈΡΠΏΠ΅ΡΡΠΈΠΈ ΠΎΡ ΡΠ»ΡΡΠ°ΠΉΠ½ΠΎΠΉ Π²Π΅Π»ΠΈΡΠΈΠ½Ρ
- Π§ΠΈΡΠ»Π΅Π½Π½ΡΠ΅ ΠΌΠ΅ΡΠΎΠ΄Ρ ΡΠ΅ΡΠ΅Π½ΠΈΡ Π½Π΅Π»ΠΈΠ½Π΅ΠΉΠ½ΡΡ ΡΡΠ°Π²Π½Π΅Π½ΠΈΠΉ
- Π Π΅ΠΊΡΡΡΠΈΠ²Π½ΡΠ΅ Π°Π»Π³ΠΎΡΠΈΡΠΌΡ
- ΠΠ΅ΠΎΠΌΠ΅ΡΡΠΈΡ
- Π Π°Π±ΠΎΡΠ° Ρ ΠΌΠ°ΡΡΠΈΠ²Π°ΠΌΠΈ ΠΈ ΠΌΠ°ΡΡΠΈΡΠ°ΠΌΠΈ
- ΠΠΎΠΈΡΠΊ ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ³ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΡ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
- ΠΠΎΠΈΡΠΊ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ³ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΡ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
- Π‘ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΌΠ°ΡΡΠΈΠ²Π° ΠΌΠ΅ΡΠΎΠ΄ΠΎΠΌ ΠΏΡΠ·ΡΡΡΠΊΠ°
- Π‘ΡΠ΅Π΄Π½Π΅Π΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π°
- ΠΠΎΠ΄Π° ΠΌΠ°ΡΡΠΈΠ²Π°
- ΠΠ΅Π΄ΠΈΠ°Π½Π° ΠΌΠ°ΡΡΠΈΠ²Π°
- Π‘ΡΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
- Π Π°Π·Π½ΠΈΡΠ° Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
- Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
- ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
- ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΊΠΎ Π²ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ ΠΌΠ°ΡΡΠΈΠ²Π°
- ΠΡΡΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΈΠ· Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π°
- Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° Π½Π° Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°
- ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π° Π½Π° ΡΠΈΡΠ»ΠΎ
- ΠΠΎΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π° Π² ΡΡΠ΅ΠΏΠ΅Π½Ρ
- ΠΠΎΠ΄ΡΠ»Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π°
- ΠΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ Π·Π½Π°ΠΊΠΎΠ² ΠΏΠ΅ΡΠ΅Π΄ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
- ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π° ΡΠ°Π½Π΄ΠΎΠΌΠ½ΡΠΌΠΈ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ
- ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π² ΠΎΠ΄ΠΈΠ½ Π±ΠΎΠ»ΡΡΠΎΠΉ
- ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΡΡΠΌΠΌΠ°)
- ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΡΠ°Π·Π½ΠΈΡΠ°)
- ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΠΏΡΠΎΠΈΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅)
- ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (Π΄Π΅Π»Π΅Π½ΠΈΠ΅)
- ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΊΠΎ Π²ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ ΠΌΠ°ΡΡΠΈΡΡ
- ΠΡΡΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΈΠ· Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ
- Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° Π½Π° Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΡΡ
- ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ Π½Π° ΡΠΈΡΠ»ΠΎ
- ΠΠΎΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ Π² ΡΡΠ΅ΠΏΠ΅Π½Ρ
- ΠΠΎΠ΄ΡΠ»Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ
- Π‘ΠΌΠ΅Π½Π° Π·Π½Π°ΠΊΠΎΠ² ΠΏΠ΅ΡΠ΅Π΄ ΡΠΈΡΠ»Π°ΠΌΠΈ Π² ΠΌΠ°ΡΡΠΈΡΠ΅
- ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΡΡ ΡΠ°Π½Π΄ΠΎΠΌΠ½ΡΠΌΠΈ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ
πΊπΈ English category
Simple arithmetic
-
Prime number
bool isPrime(const int64_t& number)
The function takes as its input argument the
number
to be checked. The function returnstrue
if the number is prime andfalse
if it is composite.
Arithmetic and geometric progressions
-
N-th term of the arithmetic progression
long double nTermOfASequence(const long double a1, const long double d, const int64_t n)
The function takes as input arguments the first element of the progression -
a1
, the difference -d
and the number of the sought element -n
. The function returns the value of the nth element.
-
Sum of members of an arithmetic progression
long double sumAprogression(const long double a1, const long double an, const int64_t n)
The function takes as input arguments the first element of the progression -
a1
, the value of the nth element -an
and the number of elements -n
. The function returns the sum of the members of the sequence.
-
N-th term of the geometric progression
long double nTermOfGSequence(const long double a, const long double q, const int64_t n)
The function takes as input arguments the first element of the progression -
a
, the denominator of the progression -q
and the number of the element sought -n
. The function returns the value of the nth element.
-
Sum of members of a geometric progression
long double sumGprogression(const long double a1, const long double an, const long double q)
The function takes as input arguments the first element of the progression -
a1
, the value of the nth element -an
and the denominator -q
. The function returns the sum of the members of the sequence.
Probability Theory and Combinatorics
-
Factorial
int64_t fac(const int64_t number)
As an input argument, the function takes the
number
to be raised to the factorial. The function returns the factorial of the entered number.
-
Probability
long double prob(const long double m, const long double n)
As input arguments
m
takes the number of favorable outcomes,n
takes the total number of test outcomes. The function returns the probability of the event.
-
Placement (order is important)
int64_t comA(const int64_t m, const int64_t n)
As input argumentsm
andn
, an ordered set ofm
different elements from some set of differentn
elements. It is important thatn
>m
. The function returns the number of placements.
-
Combination (order is NOT important)
int64_t comC(const int64_t m, const int64_t n)
As input argumentsm
andn
, a set ofm
elements chosen from then
element set, which does not take into account the order of elements. It is important thatn
>m
. The function returns the number of combinations.
-
Bernoulli formula
long double bern(const int64_t n, const int64_t k, const long double p)
As input arguments the function takes
n
- total number of trials,k
- number of favorable trials,p
- chance of favorable outcome. The function returns the probability of a given event.
-
Local Phi number
long double fiLocal(const long double x)
The function takes
x
- any number as an input argument. The function returns the value of the local number Phi from the given number.
-
The Phi number for the Laplace integral formula
long double fiIntegral(const long double x)
The function takes
x
- any number as an input argument. The function returns the value of Phi from the given number for the Laplace integral formula.
-
The finite part of the function for the number of the Laplace integral formula
double endLaplaceTheorem(const double x)
The function takes
x
- any number as an input argument. The function returns a finite number in the Laplace integral formula. Comment: A useful practical application of this function is in calculations in the Laplace integral formula.
-
Laplaceβs local theorem
long double lLaplace(const long double n, const long double k, const long double p)
As input arguments the function takes
n
- total number of trials,k
- number of favorable trials,p
- chance of favorable outcome. The function returns the probability of a given event.
-
Laplace integral theorem
long double iLaplace(const long double k1, const long double k2, const long double n, const long double p)
As input arguments the function takes
k1
- number of times at least the event will occur,k2
- number of times at most the event will occur,n
- total number of trials,p
- chance of favorable outcome. The function returns the probability of a given event.
-
Dispersion
template <typename typeArr1, typename typeArr2> long double dispersion(typeArr1* x, typeArr2* p, const int size)
As input arguments the function takes
x
- pointer to the first element of the array of random variables,p
- pointer to the first element of the array of probabilities of random variables,size
- size of one of the arrays. The function returns the variance of the value. Important: The size of both arrays must be the same.
-
Standard deviation of the variance from a random variable
template <typename typeArr1, typename typeArr2> long double sDev(typeArr1* x, typeArr2* p, const int size)
As input arguments the function takes
x
- pointer to the first element of the array of random variables,p
- pointer to the first element of the array of probabilities of random variables,size
- size of one of the arrays. The function returns the variance deviation from a random variable. Important: The size of both arrays must be the same.
Numerical methods for solving nonlinear equations
-
Half-division method
template<typename F> long double halfDivisionMethod(const F func, long double a, long double b, const long double e = 0.001)
The function takes as input arguments the equation
func
, the left and right limits of the intervala
&b
and the optional precision parametere
. The function returns the root of the equation on a given interval, with a given accuracy.
Example of usage:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "halfDivisionMethod: " << mathAlgo::halfDivisionMethod(&f, 0, 2) << endl;
}
Output:
halfDivisionMethod: 0.88623
-
Secant method
template<typename F> long double secantMethod(const F func, long double x0, long double x1, const long double e = 0.001)
The function takes as input arguments the equation
func
, the left and right limits of the intervalx0
&x1
and the optional precision parametere
. The function returns the root of the equation on a given interval, with a given accuracy.
Example of usage:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "secantMethod: " << mathAlgo::secantMethod(&f, 0, 2) << endl;
}
Output:
secantMethod: 0.886345
-
Parabola method
template<typename F> long double parabolaMethod(const F func, long double a, long double b, const long double e = 0.001)
The function takes as input arguments the equation
func
, the left and right limits of the intervala
&b
and the optional precision parametere
. The function returns the root of the equation on a given interval, with a given accuracy.
Example of usage:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "parabolaMethod: " << mathAlgo::parabolaMethod(&f, 0, 2) << endl;
}
Output:
parabolaMethod: 0.886345
Recursive algorithms
-
Fibonacci number
int64_t fibonacci(const int64_t number)
The function takes the number
n
as an input argument. The function returns the value of the Fibonacci sequence in the given position.
Geometry
-
Cotangent
long double cot(const long double number)
The function takes as its input argument the
number
whose cotangent is to be obtained. The function returns the cotangent of the entered number.
-
Arcotangent
long double acot(const long double number)
The function takes as its input argument the number
number
whose arcotangent is to be obtained. The function returns the arc tangent of the entered number.
-
Calculating the length of the segment
long double lengthOfLine(const long double x1, const long double x2, const long double y1, const long double y2, const long double z1 = 0, const long double z2 = 0)
The function takes the coordinates of points A(x1, y1) & B(x2, y2) as input arguments (z coordinates are entered for a three-dimensional coordinate system). The function returns the length of the segment.
Working with arrays and matrices
-
Finding the minimum value in an array
template <typename typeArr> typeArr aMin(typeArr* arr, const int size)
As an argument
arr
is taken an array,size
is the size of the array. Returns the minimum element of the array.
-
Finding the maximum value in an array
template <typename typeArr> typeArr aMax(typeArr* arr, const int size)
As an argument
arr
is taken an array,size
is the size of the array. Returns the maximum element of the array.
-
Sorting an array using the bubble method
template <typename typeArr> typeArr* bSort(typeArr* arr, const int size, bool asc = true)
The function takes
arr
- pointer to the beginning of the array,size
- size of the array, the argumentasc
is optional, by defaulttrue
- ascending sorting,false
- descending sorting. The function returns a pointer to the first element of the sorted array.
-
The average value of the array
template<typename typeArr> typeArr avgArr(typeArr* arr, const int size)
As an argument
arr
is taken an array,size
is the size of the array. Returns the average value of the array.
-
The mode of the array
template <typename typeArr> typeArr modenum(typeArr* arr, const int size)
As an argument
arr
is taken an array,size
is the size of the array. Returns the most frequent number.
-
The median of the array
template<typename typeArr> typeArr median(typeArr* arr, const int size)
As an argument
arr
is taken an array,size
is the size of the array. Returns the median of the array.
-
Summing two arrays
template <typename typeArr> typeArr* sumArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
As input arguments the function takes
arr0
andarr1
- pointers to the beginning of the arrays,arr2
- pointer to the first element of the array in which the previous two are summed,size
- size of the arrays (the same for three). The function returns a pointer to the first element of the modified array.
-
The difference between the two arrays
template <typename typeArr> typeArr* minArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
As input arguments the function takes
arr0
andarr1
- pointers to the beginning of arrays,arr2
- pointer to the first element of the array, which will be the difference of two previous arrays,size
- size of arrays (the same for three). Important: The difference of elements works on the principle: the element of the first array - the element of the second array. The function returns a pointer to the first element of the modified array.
-
Multiplying two arrays
template <typename typeArr> typeArr* mulArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
As input arguments the function takes
arr0
andarr1
- pointers to the beginning of arrays,arr2
- pointer to the first element of the array in which the previous two will be multiplied,size
- size of arrays (the same for three). The function returns a pointer to the first element of the modified array.
-
Dividing two arrays
template <typename typeArr> typeArr* divArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
As input arguments the function takes
arr0
andarr1
- pointers to the beginning of the arrays,arr2
- pointer to the first element of the array, which will divide the two previous arrays,size
- size of the arrays (the same for three). The function returns a pointer to the first element of the changed array. Important: The division of elements works according to the principle: element of the first array / element of the second array.
-
Adding a number to all elements of an array
template <typename typeArr, typename typeNum> typeArr* inPlusArr(typeArr* arr, const int size, const typeNum& number)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array,number
- number to be added to all elements. The function returns a pointer to the first element of the modified array.
-
Subtracting a number from all elements of an array
template <typename typeArr, typename typeNum> typeArr* inMinArr(typeArr* arr, const int size, const typeNum& number)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array,number
- number to be subtracted from all elements. The function returns a pointer to the first element of the modified array.
-
Multiplying all elements of the array by a number
template <typename typeArr, typename typeNum> typeArr* inMulArr(typeArr* arr, const int size, const typeNum& number)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array,number
- number to be multiplied by all elements of the array. The function returns a pointer to the first element of the modified array.
-
Dividing all elements of an array by a number
template <typename typeArr, typename typeNum> typeArr* inDivArr(typeArr* arr, const int size, const typeNum& number)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array,number
- number by which all array elements will be divided. The function returns a pointer to the first element of the modified array.
-
Array elements to a power
template <typename typeArr, typename typeNum> typeArr* powArr(typeArr* arr, const int size, const typeNum& gpow)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array,gpow
- degree to which all elements of the array will be raised. The function returns a pointer to the first element of the modified array.
-
Array element module
template <typename typeArr> typeArr* absArr(typeArr* arr, const int size)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array. The function returns a pointer to the first element of the modified array.
-
Changing signs before elements in an array
template <typename typeArr> typeArr* swapArr(typeArr* arr, const int size)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array. The function returns a pointer to the first element of the modified array.
-
Filling an array with random elements
template <typename typeArr> typeArr* randArr(typeArr* arr, const int size)
As input arguments the function takes
arr
- pointer to the beginning of the array,size
- size of the array. The function returns a pointer to the first element of the modified array.
-
Combining two arrays into one large one
template <typename typeArr> typeArr* uniArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
As input arguments the function takes
arr0
andarr1
- pointers to the beginning of the arrays,arr2
- pointer to the first element of the array, which will be the result of combining two arrays,size
- size of arrays (the same for the first two). The function returns a pointer to the first element of the modified array. Note: The final array is the sum of the sizes of the previous two arrays. The first two arrays must be the same size and type.
-
Combining two matrices (sum)
template <typename typeMat> typeMat* sumMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
As input arguments the function takes
mat0
andmat1
- pointers to the beginning of matrices,mat2
- pointer to the first element of the matrix which will be the result of sum of elements of two matrices,isize
- number of lines in matrix,jsize
- number of columns in matrix. The function returns a pointer to the first element of the final matrix.
-
Combining two matrices (difference)
template <typename typeMat> typeMat* minMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
As input arguments the function takes
mat0
andmat1
- pointers to the beginning of matrices,mat2
- pointer to the first element of the matrix, which will be the result of the difference of elements of two matrices,isize
- number of lines in matrix,jsize
- number of columns in matrix. The function returns a pointer to the first element of the resulting matrix.
-
The union of two matrices (multiplication)
template <typename typeMat> typeMat* mulMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
As input arguments the function takes
mat0
andmat1
- pointers to the beginning of matrices,mat2
- pointer to the first element of the matrix which will be the result of product of elements of two matrices,isize
- number of lines in matrix,jsize
- number of columns in matrix. The function returns a pointer to the first element of the resulting matrix.
-
Combining two matrices (division)
template <typename typeMat> typeMat* divMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
As input arguments the function takes
mat0
andmat1
- pointers to the beginning of matrices,mat2
- pointer to the first element of the matrix, which will be the result of division of elements of two matrices,isize
- number of lines in matrix,jsize
- number of columns in matrix. The function returns a pointer to the first element of the final matrix. Important: The function works on the principle of dividing the element of the first matrix by the element of the second matrix.
-
Adding a number to all matrix elements
template <typename typeMat, typename typeNum> typeMat* inPlusMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix,number
- number to add. The function returns a pointer to the first element of the resulting matrix.
-
Subtracting a number from all matrix elements
template <typename typeMat, typename typeNum> typeMat* inMinMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix,number
- subtracted number. The function returns a pointer to the first element of the resulting matrix.
-
Multiplying a number by all matrix elements
template <typename typeMat, typename typeNum> typeMat* inMulMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix,number
- number by which the matrix elements should be multiplied. The function returns a pointer to the first element of the resulting matrix.
-
Dividing all matrix elements by a number
template <typename typeMat, typename typeNum> typeMat* inDivMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix,number
- number by which all matrix elements will be divided. The function returns a pointer to the first element of the final matrix.
-
Expanding matrix elements
template <typename typeMat, typename typeNum> typeMat* powMat(typeMat* mat, const int isize, const int jsize, const typeNum& gpow)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix,gpow
- degree to which all elements of the array will be raised. The function returns a pointer to the first element of the resulting matrix.
-
Module of matrix elements
template <typename typeMat> typeMat* absMat(typeMat* mat, const int isize, const int jsize)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix. The function returns a pointer to the first element of the final matrix.
-
Changing signs before numbers in the matrix
template <typename typeMat> typeMat* swapMat(typeMat* mat, const int isize, const int jsize)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix. The function returns a pointer to the first element of the final matrix.
-
Filling a matrix with random elements
template <typename typeMat> typeMat* randMat(typeMat* mat, const int isize, const int jsize)
As input arguments the function takes
mat
- pointer to the beginning of the matrix,isize
- number of rows in the matrix,jsize
- number of columns in the matrix. The function returns a pointer to the first element of the final matrix.
π·πΊ Π ΡΡΡΠΊΠ°Ρ ΠΊΠ°ΡΠ΅Π³ΠΎΡΠΈΡ
ΠΡΠΎΡΡΠ°Ρ Π°ΡΠΈΡΠΌΠ΅ΡΠΈΠΊΠ°
-
ΠΡΠΎΠ²Π΅ΡΠΊΠ° ΡΠΈΡΠ»Π° Π½Π° ΠΏΡΠΎΡΡΠΎΡΡ
bool isPrime(const int64_t& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ
number
, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π½ΡΠΆΠ½ΠΎ ΠΏΡΠΎΠ²Π΅ΡΠΈΡΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρtrue
- Π΅ΡΠ»ΠΈ ΡΠΈΡΠ»ΠΎ ΠΏΡΠΎΡΡΠΎΠ΅ ΠΈfalse
- Π΅ΡΠ»ΠΈ ΡΠΎΡΡΠ°Π²Π½ΠΎΠ΅.
ΠΡΠΈΡΠΌΠ΅ΡΠΈΡΠ΅ΡΠΊΠ°Ρ ΠΈ Π³Π΅ΠΎΠΌΠ΅ΡΡΠΈΡΠ΅ΡΠΊΠ°Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
-
N-ΡΠΉ ΡΠ»Π΅Π½ Π°ΡΠΈΡΠΌΠ΅ΡΠΈΡΠ΅ΡΠΊΠΎΠΉ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
long double nTermOfASequence(const long double a1, const long double d, const int64_t n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ -
a1
, ΡΠ°Π·Π½ΠΈΡΡ -d
ΠΈ Π½ΠΎΠΌΠ΅Ρ ΠΈΡΠΊΠΎΠΌΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° -n
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ n-Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°.
-
Π‘ΡΠΌΠΌΠ° ΡΠ»Π΅Π½ΠΎΠ² Π°ΡΠΈΡΠΌΠ΅ΡΠΈΡΠ΅ΡΠΊΠΎΠΉ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
long double sumAprogression(const long double a1, const long double an, const int64_t n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ -
a1
, Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ n-Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° -an
ΠΈ ΠΊΠΎΠ»-Π²ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² -n
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΡΠΌΠΌΡ ΡΠ»Π΅Π½ΠΎΠ² ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ.
-
N-ΡΠΉ ΡΠ»Π΅Π½ Π³Π΅ΠΎΠΌΠ΅ΡΡΠΈΡΠ΅ΡΠΊΠΎΠΉ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
long double nTermOfGSequence(const long double a, const long double q, const int64_t n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ -
a
, Π·Π½Π°ΠΌΠ΅Π½Π°ΡΠ΅Π»Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ -q
ΠΈ Π½ΠΎΠΌΠ΅Ρ ΠΈΡΠΊΠΎΠΌΠΎΠ³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° -n
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ n-Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°.
-
Π‘ΡΠΌΠΌΠ° ΡΠ»Π΅Π½ΠΎΠ² Π³Π΅ΠΎΠΌΠ΅ΡΡΠΈΡΠ΅ΡΠΊΠΎΠΉ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ
long double sumGprogression(const long double a1, const long double an, const long double q)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΡΠΎΠ³ΡΠ΅ΡΡΠΈΠΈ -
a1
, Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ n-Π³ΠΎ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° -an
ΠΈ Π·Π½Π°ΠΌΠ΅Π½Π°ΡΠ΅Π»Ρ -q
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΡΠΌΠΌΡ ΡΠ»Π΅Π½ΠΎΠ² ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ.
Π’Π΅ΠΎΡΠΈΡ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΠΈ ΠΈ ΠΊΠΎΠΌΠ±ΠΈΠ½Π°ΡΠΎΡΠΈΠΊΠ°
-
Π€Π°ΠΊΡΠΎΡΠΈΠ°Π»
int64_t fac(const int64_t number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ
number
, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π½ΡΠΆΠ½ΠΎ Π²ΠΎΠ·Π²Π΅ΡΡΠΈ Π² ΡΠ°ΠΊΡΠΎΡΠΈΠ°Π». Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠ°ΠΊΡΠΎΡΠΈΠ°Π» Π²Π²Π΅Π΄Π΅Π½Π½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π°.
-
ΠΠ΅ΡΠΎΡΡΠ½ΠΎΡΡΡ
long double prob(const long double m, const long double n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ²
m
ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΡΡ ΠΈΡΡ ΠΎΠ΄ΠΎΠ²,n
- ΠΎΠ±ΡΠ΅Π΅ ΡΠΈΡΠ»ΠΎ ΠΈΡΡ ΠΎΠ΄ΠΎΠ² ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΡ ΡΠΎΠ±ΡΡΠΈΡ.
-
Π Π°Π·ΠΌΠ΅ΡΠ΅Π½ΠΈΠ΅ (ΠΏΠΎΡΡΠ΄ΠΎΠΊ Π²Π°ΠΆΠ΅Π½)
int64_t comA(const int64_t m, const int64_t n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ²m
ΠΈn
, ΡΠΏΠΎΡΡΠ΄ΠΎΡΠ΅Π½Π½ΡΠΉ Π½Π°Π±ΠΎΡ ΠΈΠ·m
ΡΠ°Π·Π»ΠΈΡΠ½ΡΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΈΠ· Π½Π΅ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ ΠΌΠ½ΠΎΠΆΠ΅ΡΡΠ²Π° ΡΠ°Π·Π»ΠΈΡΠ½ΡΡn
ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ². ΠΠ°ΠΆΠ½ΠΎ, ΡΡΠΎΠ±Ρn
>m
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΠ°Π·ΠΌΠ΅ΡΠ΅Π½ΠΈΠΉ.
-
Π‘ΠΎΡΠ΅ΡΠ°Π½ΠΈΠ΅ (ΠΏΠΎΡΡΠ΄ΠΎΠΊ ΠΠ Π²Π°ΠΆΠ΅Π½)
int64_t comC(const int64_t m, const int64_t n)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ²m
ΠΈn
, Π½Π°Π±ΠΎΡ ΠΈΠ·m
ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ², Π²ΡΠ±ΡΠ°Π½Π½ΡΡ ΠΈΠ·n
-ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ½ΠΎΠ³ΠΎ ΠΌΠ½ΠΎΠΆΠ΅ΡΡΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π½Π΅ ΡΡΠΈΡΡΠ²Π°Π΅ΡΡΡ ΠΏΠΎΡΡΠ΄ΠΎΠΊ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ². ΠΠ°ΠΆΠ½ΠΎ, ΡΡΠΎΠ±Ρn
>m
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΠΎΡΠ΅ΡΠ°Π½ΠΈΠΉ.
-
Π€ΠΎΡΠΌΡΠ»Π° ΠΠ΅ΡΠ½ΡΠ»Π»ΠΈ
long double bern(const int64_t n, const int64_t k, const long double p)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
n
- ΠΎΠ±ΡΠ΅Π΅ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ,k
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΡΡ ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ,p
- ΡΠ°Π½Ρ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΠΎΠ³ΠΎ ΠΈΡΡ ΠΎΠ΄Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΎΠ±ΡΡΠΈΡ.
-
ΠΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ Π€ΠΈ
long double fiLocal(const long double x)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
x
- Π»ΡΠ±ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ Π»ΠΎΠΊΠ°Π»ΡΠ½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π° Π€ΠΈ ΠΎΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π°.
-
Π§ΠΈΡΠ»ΠΎ Π€ΠΈ Π΄Π»Ρ ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Ρ ΠΠ°ΠΏΠ»Π°ΡΠ°
long double fiIntegral(const long double x)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
x
- Π»ΡΠ±ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° Π€ΠΈ ΠΎΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π° Π΄Π»Ρ ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Ρ ΠΠ°ΠΏΠ»Π°ΡΠ°.
-
ΠΠΎΠ½Π΅ΡΠ½Π°Ρ ΡΠ°ΡΡΡ ΡΡΠ½ΠΊΡΠΈΠΈ Π΄Π»Ρ ΡΠΈΡΠ»Π° ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Ρ ΠΠ°ΠΏΠ»Π°ΡΠ°
double endLaplaceTheorem(const double x)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
x
- Π»ΡΠ±ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΠ½Π΅ΡΠ½ΠΎΠ΅ ΡΠΈΡΠ»ΠΎ Π² ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Π΅ ΠΠ°ΠΏΠ»Π°ΡΠ°. ΠΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ: ΠΏΠΎΠ»Π΅Π·Π½ΠΎΠ΅ ΠΏΡΠ°ΠΊΡΠΈΡΠ΅ΡΠΊΠΎΠ΅ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ Π΄Π°Π½Π½Π°Ρ ΡΡΠ½ΠΊΡΠΈΡ Π½Π°Ρ ΠΎΠ΄ΠΈΡ ΠΏΡΠΈ ΡΠ°ΡΡΠ΅ΡΠ°Ρ Π² ΠΈΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½ΠΎΠΉ ΡΠΎΡΠΌΡΠ»Π΅ ΠΠ°ΠΏΠ»Π°ΡΠ°.
-
ΠΠΎΠΊΠ°Π»ΡΠ½Π°Ρ ΡΠ΅ΠΎΡΠ΅ΠΌΠ° ΠΠ°ΠΏΠ»Π°ΡΠ°
long double lLaplace(const long double n, const long double k, const long double p)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
n
- ΠΎΠ±ΡΠ΅Π΅ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ,k
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΡΡ ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ,p
- ΡΠ°Π½Ρ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΠΎΠ³ΠΎ ΠΈΡΡ ΠΎΠ΄Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΎΠ±ΡΡΠΈΡ.
-
ΠΠ½ΡΠ΅Π³ΡΠ°Π»ΡΠ½Π°Ρ ΡΠ΅ΠΎΡΠ΅ΠΌΠ° ΠΠ°ΠΏΠ»Π°ΡΠ°
long double iLaplace(const long double k1, const long double k2, const long double n, const long double p)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
k1
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΠ°Π·, Π½Π΅ ΠΌΠ΅Π½Π΅Π΅ ΠΊΠΎΡΠΎΡΡΡ ΡΠΎΠ±ΡΡΠΈΠ΅ Π½Π°ΡΡΡΠΏΠΈΡ,k2
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΠ°Π·, Π½Π΅ Π±ΠΎΠ»Π΅Π΅ ΠΊΠΎΡΠΎΡΡΡ ΡΠΎΠ±ΡΡΠΈΠ΅ Π½Π°ΡΡΡΠΏΠΈΡ,n
- ΠΎΠ±ΡΠ΅Π΅ ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΠΈΡΠΏΡΡΠ°Π½ΠΈΠΉ,p
- ΡΠ°Π½Ρ Π±Π»Π°Π³ΠΎΠΏΡΠΈΡΡΠ½ΠΎΠ³ΠΎ ΠΈΡΡ ΠΎΠ΄Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΡ Π·Π°Π΄Π°Π½Π½ΠΎΠ³ΠΎ ΡΠΎΠ±ΡΡΠΈΡ.
-
ΠΠΈΡΠΏΠ΅ΡΡΠΈΡ
template <typename typeArr1, typename typeArr2> long double dispersion(typeArr1* x, typeArr2* p, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
x
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΡΠ»ΡΡΠ°ΠΉΠ½ΡΡ Π²Π΅Π»ΠΈΡΠΈΠ½,p
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΠ΅ΠΉ ΡΠ»ΡΡΠ°ΠΉΠ½ΡΡ Π²Π΅Π»ΠΈΡΠΈΠ½,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΈΠ· ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π΄ΠΈΡΠΏΠ΅ΡΡΠΈΡ Π²Π΅Π»ΠΈΡΠΈΠ½Ρ. ΠΠ°ΠΆΠ½ΠΎ! Π Π°Π·ΠΌΠ΅Ρ ΠΎΠ±ΠΎΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΌ.
-
Π‘ΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠ΅ ΠΎΡΠΊΠ»ΠΎΠ½Π΅Π½ΠΈΠ΅ Π΄ΠΈΡΠΏΠ΅ΡΡΠΈΠΈ ΠΎΡ ΡΠ»ΡΡΠ°ΠΉΠ½ΠΎΠΉ Π²Π΅Π»ΠΈΡΠΈΠ½Ρ
template <typename typeArr1, typename typeArr2> long double sDev(typeArr1* x, typeArr2* p, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
x
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° ΡΠ»ΡΡΠ°ΠΉΠ½ΡΡ Π²Π΅Π»ΠΈΡΠΈΠ½,p
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π° Π²Π΅ΡΠΎΡΡΠ½ΠΎΡΡΠ΅ΠΉ ΡΠ»ΡΡΠ°ΠΉΠ½ΡΡ Π²Π΅Π»ΠΈΡΠΈΠ½,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ ΠΈΠ· ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΎΡΠΊΠ»ΠΎΠ½Π΅Π½ΠΈΠ΅ Π΄ΠΈΡΠΏΠ΅ΡΡΠΈΠΈ ΠΎΡ ΡΠ»ΡΡΠ°ΠΉΠ½ΠΎΠΉ Π²Π΅Π»ΠΈΡΠΈΠ½Ρ. ΠΠ°ΠΆΠ½ΠΎ! Π Π°Π·ΠΌΠ΅Ρ ΠΎΠ±ΠΎΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΌ.
Π§ΠΈΡΠ»Π΅Π½Π½ΡΠ΅ ΠΌΠ΅ΡΠΎΠ΄Ρ ΡΠ΅ΡΠ΅Π½ΠΈΡ Π½Π΅Π»ΠΈΠ½Π΅ΠΉΠ½ΡΡ ΡΡΠ°Π²Π½Π΅Π½ΠΈΠΉ
-
ΠΠ΅ΡΠΎΠ΄ Π±ΠΈΡΠ΅ΠΊΡΠΈΠΈ(Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΏΠΎΠΏΠΎΠ»Π°ΠΌ)
template<typename F> long double halfDivisionMethod(const F func, long double a, long double b, const long double e = 0.001)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΠ΅
func
, Π»Π΅Π²ΡΡ ΠΈ ΠΏΡΠ°Π²ΡΡ Π³ΡΠ°Π½ΠΈΡΡ ΠΎΡΡΠ΅Π·ΠΊΠ°a
&b
ΠΈ Π½Π΅ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ ΡΠΎΡΠ½ΠΎΡΡΠΈe
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΡΠ΅Π½Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΡ Π½Π° Π·Π°Π΄Π°Π½Π½ΠΎΠΌ ΠΏΡΠΎΠΌΠ΅ΠΆΡΡΠΊΠ΅, Ρ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡΠΎΡΠ½ΠΎΡΡΡΡ.
ΠΡΠΈΠΌΠ΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "halfDivisionMethod: " << mathAlgo::halfDivisionMethod(&f, 0, 2) << endl;
}
ΠΡΠ²ΠΎΠ΄:
halfDivisionMethod: 0.88623
-
ΠΠ΅ΡΠΎΠ΄ ΡΠ΅ΠΊΡΡΠΈΡ
template<typename F> long double secantMethod(const F func, long double x0, long double x1, const long double e = 0.001)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΠ΅
func
, Π»Π΅Π²ΡΡ ΠΈ ΠΏΡΠ°Π²ΡΡ Π³ΡΠ°Π½ΠΈΡΡ ΠΎΡΡΠ΅Π·ΠΊΠ°x0
&x1
ΠΈ Π½Π΅ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ ΡΠΎΡΠ½ΠΎΡΡΠΈe
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΡΠ΅Π½Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΡ Π½Π° Π·Π°Π΄Π°Π½Π½ΠΎΠΌ ΠΏΡΠΎΠΌΠ΅ΠΆΡΡΠΊΠ΅, Ρ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡΠΎΡΠ½ΠΎΡΡΡΡ.
ΠΡΠΈΠΌΠ΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "secantMethod: " << mathAlgo::secantMethod(&f, 0, 2) << endl;
}
ΠΡΠ²ΠΎΠ΄:
secantMethod: 0.886345
-
ΠΠ΅ΡΠΎΠ΄ ΠΏΠ°ΡΠ°Π±ΠΎΠ»
template<typename F> long double parabolaMethod(const F func, long double a, long double b, const long double e = 0.001)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΠ΅
func
, Π»Π΅Π²ΡΡ ΠΈ ΠΏΡΠ°Π²ΡΡ Π³ΡΠ°Π½ΠΈΡΡ ΠΎΡΡΠ΅Π·ΠΊΠ°a
&b
ΠΈ Π½Π΅ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΡΠΉ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡ ΡΠΎΡΠ½ΠΎΡΡΠΈe
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΡΠ΅Π½Ρ ΡΡΠ°Π²Π½Π΅Π½ΠΈΡ Π½Π° Π·Π°Π΄Π°Π½Π½ΠΎΠΌ ΠΏΡΠΎΠΌΠ΅ΠΆΡΡΠΊΠ΅, Ρ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΡΠΎΡΠ½ΠΎΡΡΡΡ.
ΠΡΠΈΠΌΠ΅Ρ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΡ:
double f(double x)
{
return (tan(0.3 * x + 0.4) - pow(x, 2));
}
int main
{
cout << "parabolaMethod: " << mathAlgo::parabolaMethod(&f, 0, 2) << endl;
}
ΠΡΠ²ΠΎΠ΄:
parabolaMethod: 0.886345
Π Π΅ΠΊΡΡΡΠΈΠ²Π½ΡΠ΅ Π°Π»Π³ΠΎΡΠΈΡΠΌΡ
-
Π§ΠΈΡΠ»ΠΎ Π€ΠΈΠ±ΠΎΠ½Π°ΡΡΠΈ
int64_t fibonacci(const int64_t number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ
n
. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ Π€ΠΈΠ±ΠΎΠ½Π°ΡΡΠΈ Π² Π·Π°Π΄Π°Π½ΠΎΠΌ ΠΏΠΎΠ»ΠΎΠΆΠ΅Π½ΠΈΠΈ.
ΠΠ΅ΠΎΠΌΠ΅ΡΡΠΈΡ
-
ΠΠΎΡΠ°Π½Π³Π΅Π½Ρ
long double cot(const long double number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ
number
, ΠΊΠΎΡΠ°Π½Π³Π΅Π½Ρ ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ Π½ΡΠΆΠ½ΠΎ ΠΏΠΎΠ»ΡΡΠΈΡΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΊΠΎΡΠ°Π½Π³Π΅Π½Ρ Π²Π²Π΅Π΄Π΅Π½Π½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π°.
-
ΠΡΠΊΠΊΠΎΡΠ°Π½Π³Π΅Π½Ρ
long double acot(const long double number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΠΎΠ³ΠΎ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠ° ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΡΠΈΡΠ»ΠΎ
number
, Π°ΡΠΊΠΊΠΎΡΠ°Π½Π³Π΅Π½Ρ ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ Π½ΡΠΆΠ½ΠΎ ΠΏΠΎΠ»ΡΡΠΈΡΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π°ΡΠΊΠΊΠΎΡΠ°Π½Π³Π΅Π½Ρ Π²Π²Π΅Π΄Π΅Π½Π½ΠΎΠ³ΠΎ ΡΠΈΡΠ»Π°.
-
Π Π°ΡΡΠ΅Ρ Π΄Π»ΠΈΠ½Ρ ΠΎΡΡΠ΅Π·ΠΊΠ°
long double lengthOfLine(const long double x1, const long double x2, const long double y1, const long double y2, const long double z1 = 0, const long double z2 = 0)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΡΠΎΡΠ΅ΠΊ A(x1, y1) & B(x2, y2)(ΠΏΡΠΈ ΡΡΠ΅Ρ ΠΌΠ΅ΡΠ½ΠΎΠΉ ΡΠΈΡΡΠ΅ΠΌΠ΅ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°Ρ Π²Π²ΠΎΠ΄ΡΡΡΡ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ z). Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π΄Π»ΠΈΠ½Ρ ΠΎΡΡΠ΅Π·ΠΊΠ°.
Π Π°Π±ΠΎΡΠ° Ρ ΠΌΠ°ΡΡΠΈΠ²Π°ΠΌΠΈ ΠΈ ΠΌΠ°ΡΡΠΈΡΠ°ΠΌΠΈ
-
ΠΠΎΠΈΡΠΊ ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ³ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΡ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
template <typename typeArr> typeArr aMin(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΌΠΈΠ½ΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠΎΠΈΡΠΊ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΠΎΠ³ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΡ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
template <typename typeArr> typeArr aMax(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΌΠ°ΠΊΡΠΈΠΌΠ°Π»ΡΠ½ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π‘ΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΌΠ°ΡΡΠΈΠ²Π° ΠΌΠ΅ΡΠΎΠ΄ΠΎΠΌ ΠΏΡΠ·ΡΡΡΠΊΠ°
template <typename typeArr> typeArr* bSort(typeArr* arr, const int size, bool asc = true)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π°ΡΠ³ΡΠΌΠ΅Π½Ρasc
Π½Π΅ ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»Π΅Π½ Π΄Π»Ρ Π·Π°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΡ, ΠΏΠΎ-ΡΠΌΠΎΠ»ΡΠ°Π½ΠΈΡtrue
- ΡΠΎΡΡΠΈΡΠΎΠ²ΠΊΠ° ΠΏΠΎ-Π²ΠΎΠ·ΡΠ°ΡΡΠ°Π½ΠΈΡ,false
- ΠΏΠΎ-ΡΠ±ΡΠ²Π°Π½ΠΈΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΎΡΡΠΎΡΡΠΈΡΠΎΠ²Π°Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π‘ΡΠ΅Π΄Π½Π΅Π΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π°
template<typename typeArr> typeArr avgArr(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΡΠ΅Π΄Π½Π΅Π΅ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠΎΠ΄Π° ΠΌΠ°ΡΡΠΈΠ²Π°
template <typename typeArr> typeArr modenum(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ Π½Π°ΠΈΠ±ΠΎΠ»Π΅Π΅ ΡΠ°ΡΡΠΎ Π²ΡΡΡΠ΅ΡΠ°ΡΡΠ΅Π΅ΡΡ ΡΠΈΡΠ»ΠΎ.
-
ΠΠ΅Π΄ΠΈΠ°Π½Π° ΠΌΠ°ΡΡΠΈΠ²Π°
template<typename typeArr> typeArr median(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΠΌΠ΅Π΄ΠΈΠ°Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π‘ΡΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
template <typename typeArr> typeArr* sumArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr0
ΠΈarr1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,arr2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π±ΡΠ΄ΡΡ ΡΡΠΌΠΌΠΈΡΠΎΠ²Π°Π½Ρ Π΄Π²Π° ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ ,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² (ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ Π΄Π»Ρ ΡΡΠΎΠΈΡ ). Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π Π°Π·Π½ΠΈΡΠ° Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
template <typename typeArr> typeArr* minArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr0
ΠΈarr1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,arr2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π±ΡΠ΄Π΅Ρ ΡΠ°Π·Π½ΠΈΡΠ° Π΄Π²ΡΡ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² (ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ Π΄Π»Ρ ΡΡΠΎΠΈΡ ). ΠΠ°ΠΆΠ½ΠΎ! Π Π°Π·Π½ΠΈΡΠ° ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΡΠ°Π±ΠΎΡΠ°Π΅Ρ ΠΏΠΎ ΠΏΡΠΈΠ½ΡΠΈΠΏΡ: ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΠ΅ΡΠ²ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π° - ΡΠ»Π΅ΠΌΠ΅Π½Ρ Π²ΡΠΎΡΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
template <typename typeArr> typeArr* mulArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr0
ΠΈarr1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,arr2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π±ΡΠ΄ΡΡ ΡΠΌΠ½ΠΎΠΆΠ΅Π½Ρ Π΄Π²Π° ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ ,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² (ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ Π΄Π»Ρ ΡΡΠΎΠΈΡ ). Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²
template <typename typeArr> typeArr* divArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr0
ΠΈarr1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,arr2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π±ΡΠ΄Π΅Ρ Π΄Π΅Π»Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² (ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ Π΄Π»Ρ ΡΡΠΎΠΈΡ ). Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°. ΠΠ°ΠΆΠ½ΠΎ! ΠΠ΅Π»Π΅Π½ΠΈΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΡΠ°Π±ΠΎΡΠ°Π΅Ρ ΠΏΠΎ ΠΏΡΠΈΠ½ΡΠΈΠΏΡ: ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΏΠ΅ΡΠ²ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π° / ΡΠ»Π΅ΠΌΠ΅Π½Ρ Π²ΡΠΎΡΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΊΠΎ Π²ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ ΠΌΠ°ΡΡΠΈΠ²Π°
template <typename typeArr, typename typeNum> typeArr* inPlusArr(typeArr* arr, const int size, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°,number
- ΡΠΈΡΠ»ΠΎ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄Π΅Ρ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΎ ΠΊΠΎ Π²ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΡΡΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΈΠ· Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π°
template <typename typeArr, typename typeNum> typeArr* inMinArr(typeArr* arr, const int size, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°,number
- ΡΠΈΡΠ»ΠΎ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄Π΅Ρ Π²ΡΡΡΠ΅Π½ΠΎ ΠΈΠ· Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ². Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° Π½Π° Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°
template <typename typeArr, typename typeNum> typeArr* inMulArr(typeArr* arr, const int size, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°,number
- ΡΠΈΡΠ»ΠΎ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄Π΅Ρ ΡΠΌΠ½ΠΎΠΆΠ΅Π½Π½ΠΎ Π½Π° Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π° Π½Π° ΡΠΈΡΠ»ΠΎ
template <typename typeArr, typename typeNum> typeArr* inDivArr(typeArr* arr, const int size, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°,number
- ΡΠΈΡΠ»ΠΎ, Π½Π° ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄ΡΡ ΠΏΠΎΠ΄Π΅Π»Π΅Π½Π½Ρ Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠΎΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π° Π² ΡΡΠ΅ΠΏΠ΅Π½Ρ
template <typename typeArr, typename typeNum> typeArr* powArr(typeArr* arr, const int size, const typeNum& gpow)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°,gpow
- ΡΡΠ΅ΠΏΠ΅Π½Ρ, Π² ΠΊΠΎΡΠΎΡΡΡ Π±ΡΠ΄ΡΡ Π²ΠΎΠ·Π²Π΅Π΄Π΅Π½Ρ Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠΎΠ΄ΡΠ»Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΠ²Π°
template <typename typeArr> typeArr* absArr(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ Π·Π½Π°ΠΊΠΎΠ² ΠΏΠ΅ΡΠ΅Π΄ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ Π² ΠΌΠ°ΡΡΠΈΠ²Π΅
template <typename typeArr> typeArr* swapArr(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΠ²Π° ΡΠ°Π½Π΄ΠΎΠΌΠ½ΡΠΌΠΈ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ
template <typename typeArr> typeArr* randArr(typeArr* arr, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°.
-
ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² Π² ΠΎΠ΄ΠΈΠ½ Π±ΠΎΠ»ΡΡΠΎΠΉ
template <typename typeArr> typeArr* uniArr(typeArr* arr0, typeArr* arr1, typeArr* arr2, const int size)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
arr0
ΠΈarr1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,arr2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΠ²Π°, Π² ΠΊΠΎΡΠΎΡΠΎΠΌ Π±ΡΠ΄Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΠΎΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΡ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ²,size
- ΡΠ°Π·ΠΌΠ΅Ρ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ² (ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²ΡΠΉ Π΄Π»Ρ ΠΏΠ΅ΡΠ²ΡΡ Π΄Π²ΡΡ ). Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½Π½ΠΎΠ³ΠΎ ΠΌΠ°ΡΡΠΈΠ²Π°. ΠΠ°ΠΆΠ½ΠΎ! ΠΡΠΎΠ³ΠΎΠ²ΡΠΉ ΠΌΠ°ΡΡΠΈΠ² ΡΠΎΡΡΠ°Π²Π»ΡΠ΅Ρ ΡΡΠΌΠΌΡ ΡΠ°Π·ΠΌΠ΅ΡΠΎΠ² Π΄Π²ΡΡ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΡ ΠΌΠ°ΡΡΠΈΠ²ΠΎΠ². ΠΠ΅ΡΠ²ΡΠ΅ Π΄Π²Π° ΠΌΠ°ΡΡΠΈΠ²Π° Π΄ΠΎΠ»ΠΆΠ½Ρ Π±ΡΡΡ ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²Ρ ΠΏΠΎ ΡΠ°Π·ΠΌΠ΅ΡΡ ΠΈ ΡΠΈΠΏΡ.
-
ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΡΡΠΌΠΌΠ°)
template <typename typeMat> typeMat* sumMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat0
ΠΈmat1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡ,mat2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΡΡ, Π² ΠΊΠΎΡΠΎΡΠΎΠΉ Π±ΡΠ΄Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΡΡΠΌΠΌΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΡΠ°Π·Π½ΠΈΡΠ°)
template <typename typeMat> typeMat* minMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat0
ΠΈmat1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡ,mat2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΡΡ, Π² ΠΊΠΎΡΠΎΡΠΎΠΉ Π±ΡΠ΄Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΡΠ°Π·Π½ΠΈΡΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (ΠΏΡΠΎΠΈΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅)
template <typename typeMat> typeMat* mulMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat0
ΠΈmat1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡ,mat2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΡΡ, Π² ΠΊΠΎΡΠΎΡΠΎΠΉ Π±ΡΠ΄Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ ΠΏΡΠΎΠΈΠ·Π²Π΅Π΄Π΅Π½ΠΈΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠ±ΡΠ΅Π΄ΠΈΠ½Π΅Π½ΠΈΠ΅ Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ (Π΄Π΅Π»Π΅Π½ΠΈΠ΅)
template <typename typeMat> typeMat* divMat(typeMat* mat0, typeMat* mat1, typeMat* mat2, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat0
ΠΈmat1
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»ΠΈ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡ,mat2
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΌΠ°ΡΡΠΈΡΡ, Π² ΠΊΠΎΡΠΎΡΠΎΠΉ Π±ΡΠ΄Π΅Ρ ΡΠ΅Π·ΡΠ»ΡΡΠ°Ρ Π΄Π΅Π»Π΅Π½ΠΈΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² Π΄Π²ΡΡ ΠΌΠ°ΡΡΠΈΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ. ΠΠΠΠΠ! Π€ΡΠ½ΠΊΡΠΈΡ ΡΠ°Π±ΠΎΡΠ°Π΅Ρ ΠΏΠΎ ΠΏΡΠΈΠ½ΡΠΈΠΏΡ Π΄Π΅Π»Π΅Π½ΠΈΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ° ΠΏΠ΅ΡΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ Π½Π° ΡΠ»Π΅ΠΌΠ΅Π½Ρ Π²ΡΠΎΡΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΊΠΎ Π²ΡΠ΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌ ΠΌΠ°ΡΡΠΈΡΡ
template <typename typeMat, typename typeNum> typeMat* inPlusMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅,number
- Π΄ΠΎΠ±Π°Π²Π»ΡΠ΅ΠΌΠΎΠ΅ ΡΠΈΡΠ»ΠΎ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΡΡΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° ΠΈΠ· Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ
template <typename typeMat, typename typeNum> typeMat* inMinMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅,number
- Π²ΡΡΠΈΡΠ°Π΅ΠΌΠΎΠ΅ ΡΠΈΡΠ»ΠΎ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
Π£ΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅ ΡΠΈΡΠ»Π° Π½Π° Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΡΡ
template <typename typeMat, typename typeNum> typeMat* inMulMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅,number
- ΡΠΈΡΠ»ΠΎ, Π½Π° ΠΊΠΎΡΠΎΡΠΎΠ΅ Π½ΡΠΆΠ½ΠΎ ΡΠΌΠ½ΠΎΠΆΠΈΡΡ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΡΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠ΅Π»Π΅Π½ΠΈΠ΅ Π²ΡΠ΅Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ Π½Π° ΡΠΈΡΠ»ΠΎ
template <typename typeMat, typename typeNum> typeMat* inDivMat(typeMat* mat, const int isize, const int jsize, const typeNum& number)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅,number
- ΡΠΈΡΠ»ΠΎ, Π½Π° ΠΊΠΎΡΠΎΡΠΎΠ΅ Π±ΡΠ΄ΡΡ ΠΏΠΎΠ΄Π΅Π»Π΅Π½Ρ Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΡΡ. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠΎΠ·Π²Π΅Π΄Π΅Π½ΠΈΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ Π² ΡΡΠ΅ΠΏΠ΅Π½Ρ
template <typename typeMat, typename typeNum> typeMat* powMat(typeMat* mat, const int isize, const int jsize, const typeNum& gpow)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅,gpow
- ΡΡΠ΅ΠΏΠ΅Π½Ρ, Π² ΠΊΠΎΡΠΎΡΡΡ Π±ΡΠ΄ΡΡ Π²ΠΎΠ·Π²Π΅Π΄Π΅Π½Ρ Π²ΡΠ΅ ΡΠ»Π΅ΠΌΠ΅Π½ΡΡ ΠΌΠ°ΡΡΠΈΠ²Π°. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠΎΠ΄ΡΠ»Ρ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΠΌΠ°ΡΡΠΈΡΡ
template <typename typeMat> typeMat* absMat(typeMat* mat, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
Π‘ΠΌΠ΅Π½Π° Π·Π½Π°ΠΊΠΎΠ² ΠΏΠ΅ΡΠ΅Π΄ ΡΠΈΡΠ»Π°ΠΌΠΈ Π² ΠΌΠ°ΡΡΠΈΡΠ΅
template <typename typeMat> typeMat* swapMat(typeMat* mat, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.
-
ΠΠ°ΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ ΠΌΠ°ΡΡΠΈΡΡ ΡΠ°Π½Π΄ΠΎΠΌΠ½ΡΠΌΠΈ ΡΠ»Π΅ΠΌΠ΅Π½ΡΠ°ΠΌΠΈ
template <typename typeMat> typeMat* randMat(typeMat* mat, const int isize, const int jsize)
Π ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ Π²Ρ ΠΎΠ΄Π½ΡΡ Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ² ΡΡΠ½ΠΊΡΠΈΡ ΠΏΡΠΈΠ½ΠΈΠΌΠ°Π΅Ρ
mat
- ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° Π½Π°ΡΠ°Π»ΠΎ ΠΌΠ°ΡΡΠΈΡΡ,isize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΡΠΎΠΊ Π² ΠΌΠ°ΡΡΠΈΡΠ΅,jsize
- ΠΊΠΎΠ»ΠΈΡΠ΅ΡΡΠ²ΠΎ ΡΡΠΎΠ»Π±ΡΠΎΠ² Π² ΠΌΠ°ΡΡΠΈΡΠ΅. Π€ΡΠ½ΠΊΡΠΈΡ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅Ρ ΡΠΊΠ°Π·Π°ΡΠ΅Π»Ρ Π½Π° ΠΏΠ΅ΡΠ²ΡΠΉ ΡΠ»Π΅ΠΌΠ΅Π½Ρ ΠΈΡΠΎΠ³ΠΎΠ²ΠΎΠΉ ΠΌΠ°ΡΡΠΈΡΡ.