线性方程组的矩阵表示
A Linear Equation can be represented in matrix form using a:
线性方程可以使用以下形式以矩阵形式表示 :
Coefficient Matrix
系数矩阵
Variable Matrix and
可变矩阵和
Constant Matrix
常数矩阵
The System of linear equation in three variables,
由三个变量组成的线性方程组,
a1x+b1y+c1z=d1
a2x+b2y+c2z=d2
a3x+b3y+c3z=d3
The Matrix Representation would be
矩阵表示为
a1 b1 c1 xd1
a2 b2 c2y =d2
a3 b3 c3 zd3
We generalize the result of n variable
我们推广n变量的结果
a1 b1 c1
a2 b2 c2 __ Coefficient Matrix
a3 b3 c3
x,y,z are Variable Matrix
d1,d2,d3 are Constant Matrix
Consider the System,
考虑一下系统
x+2y+3z=4
5x+6y+7z=8
8x+7y+6z=5
Then, the coefficient matrix for the above system is
然后,上述系统的系数矩阵为
1 2 3
5 6 7
8 7 6
Variable Matrix are X, Y, Z
变量矩阵是X , Y , Z
Constant Matrix are 4,8,5
常数矩阵为4,8,5
Representing of linear Matrix in above System is:
上述系统中线性矩阵的表示为:
1 2 3 x 4
5 6 7 y = 8
8 7 6 z 5
C ++程序以矩阵形式实现线性方程的表示 (C++ program to implement the Representation of Linear Equation in Matrix form)
#include <iostream>
using namespace std;
int main()
{
cout<< "Enter the number of variables in the equations: ";
int n;
cin>> n;
char var = 'x';
int a[n][n],b[n][1];
for (int i = 0; i< n; i++)
{
for (int j = 0; j < n; j++)
{
cin>> a[i][j]; //Get the Matrix values
}
cin>> b[i][0]; //Get the constant values
}
cout<< "\nLinear Equation in Matrix representation is: \n";
for (int i = 0; i< n; i++)
{
for (int j = 0; j < n; j++)
{
cout<<" "<< a[i][j]; //print the matrix values
}
//print the variable and constant values
cout<< " " <<static_cast<char>(var) << " = " << b[i][0]<< "\n";
var++;
}
return 0;
}
Output
输出量
Enter the number of variables in the equations:
3
1 2 3 4
5 6 7 8
8 7 6 5
Linear Equation in Matrix representation is:
1 2 3 x = 4
5 6 7 y = 8
8 7 6 z = 5
Applications:
应用范围:
Systems of Linear Equations can be used to solve some Real – Time Problems:
线性方程组可以用来解决一些实时问题 :
Solving a Mixture problems
解决混合物问题
Distance Rate Time problems
距离率时间问题
Business Based Problems
基于业务的问题
翻译自: https://www.includehelp.com/cpp-programs/representing-system-of-linear-equations-using-matrix.aspx
线性方程组的矩阵表示