octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octsympy-0.1.0, symbolic package


From: Colin Macdonald
Subject: Re: Octsympy-0.1.0, symbolic package
Date: Wed, 24 Sep 2014 12:02:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

On 24/09/14 11:21, bbbear2002 wrote:
> Respected Professor Macdonald, could Octsympy support matrix series
> summation, please? It is wished to do the following calculation:
> A=[1,2,3;2,1,4;3,5,1]
> syms n
> B=symsum[A^n/sym('n!'),n,0,inf]
> Could Octsympy do this? Thank you in advance!!!

There a several things to fix.  Can you help by filing some issues as
below?

1)  "A^n" gives an error, but this I can fix (could you please file an
issue for this at github.com/cbm755/octsympy/issues?)

2)  Unfortunately, I think it might be difficult.  OctSymPy is based
on SymPy and this doesn't work for me in SymPy:

>> A = Matrix([[1,2,3],[2,1,4],[3,5,1]])
>> B = MatPow(A, n) / factorial(n)   # this is what A^n should do
>> summation(B, (n, 0, oo))
>>
>> AttributeError: 'MatMul' object has no attribute 'expand'

3)  component-wise"symsum(A.^n, ...)" should be easy, although that
gives an error in SymPy too!  I can file this upstream with SymPy.

4)  A reasonable approach to this problem is to compute an
eigendecomposition of the matrix.  Then do the symsum on the
eigenvalues and reconstruct.

[V,D] = eig(A)
symsum(D(1,1)^n/n, n, 0, inf)
% and same for other eigenvals, then put them in a diagonal matrix
M = diag ...
Then reconstruct, something like:
B = V*M*inv(V)

Unfortunately, eig() command is not overloaded yet.  This is an easy
fix.  Can you file an issue for that?  I can fix that this afternoon.

Thanks for this, lots of nice things we can fix in OctSymPy from this
example.

best,
Colin

Attachment: 0xC5326EE5.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]