Matlab中符号方程组的快速求解方法

Matlab中符号方程组的快速求解方法,matlab,equation,Matlab,Equation,我有一个方程组,有100001个变量(x1到x100000和alpha)和那么多的方程。是否有一种计算效率高的方法,在Matlab或其他方面,来解决这个方程组。我知道solve()命令,但我想知道是否有什么东西可以运行得更快。方程式的形式如下: 1.) -x1 + alpha * (x4 + x872 + x9932) = 0 . . . 100000.) -x100000 + alpha * (x38772 + x95) = 0

我有一个方程组,有100001个变量(x1到x100000和alpha)和那么多的方程。是否有一种计算效率高的方法,在Matlab或其他方面,来解决这个方程组。我知道solve()命令,但我想知道是否有什么东西可以运行得更快。方程式的形式如下:

1.)      -x1 + alpha * (x4 + x872 + x9932) = 0
         .
         .
         .
100000.) -x100000 + alpha * (x38772 + x95) = 0

<> P>第i方程具有变量席,系数α1加上α*(其他变量的和)等于0。最后一个等式就是x1+…+x100000=1。

数学部分

该系统可能始终处于本征[值/向量]方程的标准形式:

**A***x*=λx

其中A是系统的矩阵,x=[x1;x2;…;x100000]。以此为例,系统可写为:

/               \   /    \             /    \
| 0  1  0  0  0 |   | x1 |             | x1 |
| 0  0  1  0  1 |   | x2 |             | x2 |
| 1  0  0  0  0 | x | x3 | = (1/alpha) | x3 |
| 0  0  1  0  0 |   | x4 |             | x4 |
| 0  1  0  1  0 |   | x5 |             | x5 |
\               /   \    /             \    /
这意味着你的特征值λ=1/α。当然,你应该注意复特征值(除非你真的想考虑它们)

Matlab部分

这很符合你的品味和技能。使用
eig()
总能找到矩阵的特征值。最好使用稀疏矩阵(内存经济):

N=100000;
A=稀疏(N,N);
%这是设置A值的代码
A_lambda=eig(A);
ieps=0e-6;%低于此阈值的虚部视为空

alpha=real(1./)A_lambda(arrayfun)(@(x)imag(x)
alpha
也是未知的,不是吗?是的,我更新了问题以反映这一点。
N = 100000;
A = sparse(N,N);
% Here's your code to set A's values
A_lambda = eig(A);

ieps= 0e-6;   % below this threshold imaginary part is considered null
alpha = real(1 ./ (A_lambda(arrayfun(@(x) imag(x)<ieps, A_lambda)))); % Chose Real. Choose Life. Choose a job. Choose a career. Choose a family. Choose a f****** big television, choose washing machines, cars, compact disc players and electrical tin openers. Choose good health, low cholesterol, and dental insurance. Choose fixed interest mortgage repayments. Choose a starter home. Choose your friends. Choose leisurewear and matching luggage. Choose a three-piece suit on hire purchase in a range of f****** fabrics. Choose DIY and wondering who the f*** you are on a Sunday morning. Choose sitting on that couch watching mind-numbing, spirit-crushing game shows, stuffing f****** junk food into your mouth. Choose rotting away at the end of it all, pissing your last in a miserable home, nothing more than an embarrassment to the selfish, f***** up brats you spawned to replace yourself. Chose life.

% Now do your stuff with alpha here