proposal about vectors



Am 19 Nov 2008 um 7:24 hat Viktor T. Toth geschrieben:

> Interesting. I think that the listarith:false behavior is simply wrong, and
> I think I know why it happens... trouble is, it may be harder to fix than
> the original issue, that is, extending listarith to do its stuff for
> matrices, too.
> 
> Haven't looked at the code yet, but it seems pretty clear to me what
> happens: when we suppress list-specific evaluation with listarith:false, the
> general simplifier takes over. The simplifier doesn't care that [1,2] is a
> list; all it knows are generic rules, such as 0*anything = 0 or
> anything-anything = 0. So, we have to make sure that these generic
> simplifications are suppressed for lists; or perhaps, we have to make sure
> that they never get a chance, by not suppressing list-specific
> simplification in cases such as 0*[1,2] even when listarith is false.

Yes,  this is was I expected. I believe there must be some places with 
(if $listarith (multiply) (don't multiply))
where we just can change it to
(if (or $listarith (null factor)) (multiply) (don't multiply)).

I can also watch out for these places. If we can't get that work, we can patch the simplifier 
itself. I had to do this for my approach of a new data type vector. There is just the same 
problem. I patched plusin to get what I want. 

But I hope this (or $listarith (null factor)) will do it.

Volker

> I'll have to think about this.
> 
> 
> Viktor
> 
> 
> -----Original Message-----
> From: van Nek [mailto:van.nek at arcor.de] 
> Sent: Wednesday, November 19, 2008 2:20 AM
> To: Viktor T. Toth
> Cc: Maxima at math.utexas.edu
> Subject: RE: [Maxima] proposal about vectors
> 
> Viktor,
> 
> I have noticed that with listarith:false we have the following
> 
> (%i1) 0*[1,2];
> (%o1)                               [0, 0]
> (%i2) [1,2]-[1,2];
> (%o2)                               [0, 0]
> (%i3) listarith:false$
> (%i4) 0*[1,2];
> (%o4)                                  0
> (%i5) [1,2]-[1,2];
> (%o5)                                  0
> 
> So if we want to use listarith:false for vectors, we must allow 0 * vector
> to be the exception 
> from the general rule. 
> 
> So if listarith=true or factor=0 then factor*[a,b] ---> [0,0]. 
> Matrices accordingly.
> 
> What do you think? Perhaps on your work on listarith you step over this
> point.
> 
> Volker
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima