Symsum multidimensionalfunction error sym/colon
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
A = [0 1 2 3; -1 0 -2 -3; 4 0 8 9; -6 -7 8 0]; t= 2; E = [0 0 0 0; 0 0 0 0; 0 1 0 0; -0 0 0 0];
function f = partko(k)
t=evalin('base','t'); % t is number in {1,2,...k,}
A=evalin('base','A'); % A is real 4x4-Matrix
E=evalin('base','E'); % E is real 4x4-Matrix, where all entries are 0, entry (i,j) is 1
f=((t^(k+1))/factorial(k+1))*kommpo2(E,A,k);
________
innerfuntkion %% commutator potential
function f = kommpo2(E,A,k)
a=E;
for i=1:1:k
a=komm(a,A);
end
f=a;
__
%% innerfunciton matrix commutator regular
function f = komm(E,A)
f=E*A-A*E;
__
I am running the symsum function in order to receive a sum > syms k; symsum(partko(k),0,Inf)
I seems, the inner function is to complicated for matlab to evaluate with symsum, since the following erroer message appears, even if sum is finite!:
EDU>> symsum(partko(k),0,10) Error using sym/colon (line 27) Cannot compute the number of steps from 1 to k by 1.
Error in kommpo2 (line 4) for i=1:1:k
Error in partko (line 6) f=((t^(k+1))/factorial(k+1))*kommpo2(E,A,k);
How can I modify my application? Anny ideas? Thank you very much.
0 Commenti
Risposte (1)
Walter Roberson
il 11 Nov 2012
You have the line
for i=1:1:k
In order for that to be calculated, k has to have a definite value. But it doesn't: it is the "syms k".
Please remember that when you have the line
symsum(partko(k),0,10)
that that means that the expression partko(k) should be evaluated, and that the result should be passed to symsum().
5 Commenti
Walter Roberson
il 12 Nov 2012
It sounds as if you do not need to work symbolically at all, and instead just need a "while" loop.
Vedere anche
Categorie
Scopri di più su Calculus in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!