Recent changes to 2729: declare(...,nonscalar) bug http://sourceforge.net/p/maxima/bugs/2729/2014-05-05T21:11:32Z#2729 declare(...,nonscalar) bug 2014-05-05T21:11:32Z2014-05-05T21:11:32ZRupert Swarbrickhttp://sourceforge.net/u/rswarbrick/http://sourceforge.net0839ebb7e6953f9d6504c602f186a2834c63f0e1<div class="markdown_content"><ul>
<li><strong>status</strong>: open --> closed</li>
</ul></div>#2729 declare(...,nonscalar) bug 2014-05-05T21:11:19Z2014-05-05T21:11:19ZRupert Swarbrickhttp://sourceforge.net/u/rswarbrick/http://sourceforge.net7c45d8531aa85442afca9d5ef202f81e8a3c8dbe<div class="markdown_content"><p>Well, this is "by design". It might not be the behaviour you are after, of course.</p>
<p>To get the behaviour you need, the solution is to explicitly tell Maxima to use non-commutative multiplication inside matrix products. The relevant flag is <code>matrix_element_mult</code>:</p>
<div class="codehilite"><pre>(%i19) amat:matrix([a_1,b_1]);
(%o19) [ a_1 b_1 ]
(%i20) bmat:matrix([b_1],[-a_1]);
[ b_1 ]
(%o20) [ ]
[ - a_1 ]
(%i21) ldisp([amat,bmat,amat.bmat]), matrix_element_mult=".";
[ b_1 ]
(%t21) [[ a_1 b_1 ], [ ], a_1 . b_1 - b_1 . a_1]
[ - a_1 ]
(%o21) [%t21]
(%i22) ldisp([amat,bmat,amat.bmat]), matrix_element_mult="*";
[ b_1 ]
(%t22) [[ a_1 b_1 ], [ ], 0]
[ - a_1 ]
(%o22) [%t22]
</pre></div>
<p>The default behaviour is <code>matrix_element_mult = "*"</code>, which gave the zero you didn't want.</p>
<p>I agree that it feels slightly clunky to have to tell Maxima how to do multiplication. I guess another option for you would be to permanently bind <code>matrix_element_mult</code> to "." and then to explicitly declare things scalar. I haven't checked, but I think that should work. (It sounds like it would quickly get very annoying though!)</p>
<p>Anyway, I'm closing this bug, because I think it's a case of the design not being quite what you were expecting, rather than an implementation bug. Obviously, feel free to re-open and explain what I've misunderstood about the report if I'm wrong.</p></div>declare(...,nonscalar) bug 2014-05-03T07:14:13Z2014-05-03T07:14:13Zdan hayeshttp://sourceforge.net/u/zmth/http://sourceforge.netd736819f5a0a89d1993d02d58332af45eee281cc<div class="markdown_content"><p>wxMaxima version: 13.4.0<br />
Maxima version: 5.31.1<br />
Maxima build date: 2013-09-24 09:49:12<br />
Host type: i686-pc-mingw32<br />
Lisp implementation type: GNU Common Lisp (GCL)<br />
Lisp implementation version: GCL 2.6.8</p>
<p>(declare(a_1,nonscalar),declare(b_1,nonscalar),amat:matrix(<span>[a_1,b_1]</span>)<br />
,bmat:matrix(<span>[b_1]</span>,<span>[-a_1]</span>),ldisp(<span>[amat,bmat,amat.bmat]</span>))</p>
<p>Now the output gives 0 for amat.bmat which also shows the declare(..,nonscalar) did NOT work as it should because the answer one would desire in this case is a_1.b_1 - b_1.a_1 </p>
<p>This is an example of the need to denote variables as non-commute. For example in my particular need to express symbolically a block matrix which has other matrices within it of arbitrary dimensions and we want to multiply this by another block matrix, assuming the dimensions of the ' inside ' matices are such that they are commensurate for multiplication, retaining the correct order since we want to assume in general the ' inside ' matrices do not commute .</p></div>declare(...,nonscalar) bug 2014-05-03T07:14:13Z2014-05-03T07:14:13Zdan hayeshttp://sourceforge.net/u/zmth/http://sourceforge.net1a4d088d340cde97a6772d4754393b3686e35b57<div class="markdown_content"><p>Ticket 2729 has been modified: declare(...,nonscalar) bug <br />
Edited By: Rupert Swarbrick (rswarbrick)<br />
Status updated: u'open' => u'closed'</p></div>