Slow matrix computations with symbolic variables
3 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to do matrix calculations with symbolic coefficients (the matrices themselves are not symbolic). However, even just adding and multiplying matrices is taking a tremendously long time. For example:
x = sym['x', [1 3]];
A = rand(1000);
B = rand(1000);
C = rand(1000);
x(1)*A + x(2)*B + x(3)*C
takes at least half an hour (I cancelled the computation at that point). Throwing in matrix multiiplication makes the problem even worse. I can understand why things like diagonalizing matrices with symbolic variables would take a long time, but I don't see why something like this should take so long. Can someone explain what the issue is, and maybe offer some advice?
As a side note, the only reason I'm writing functions with symbolic variables is so that I can analytically take derivatives of it. So while I could do something like
f = function F(x)
f = x(1)*A + x(2)*B + x(3)*C;
end
,I couldn't analytically take derivatives of the function (the actual function I'm working with is much longer and messier).
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!