Am 16 Nov 2008 um 11:42 hat Robert Dodier geschrieben:
> On 11/15/08, van Nek <van.nek at arcor.de> wrote:
>
> > tellsimp tells me that defining rules on + and * might not work.
>
> As it happens, tellsimpafter handles + and * differently than tellsimp ...
> tellsimpafter gathers up all the operands of one type, then all of another
> type, etc. (I think that makes sense for any commutative operator,
> but at present it works only for + and *.)
Robert,
I guess that identities like
vector(8,9)-vector(8,9); --> vector(0,0)
0*vector(8,9); --> vector(0,0)
are not possible for tellsimpafter. Or is there a way? That would make things easier.
> (%i7) 5*a*vector(x, y) - 6*b*vector(u, v);
> (%o7) vector(5 a x - 6 b u, 5 a y - 6 b v)
>>
> > Generally I do not plan do create builtin simplifications for vectors.
> > For better readability vector expressions should only be nicely
> > displayed when typed in and only be simplified if
> > the user asks explicitely for it. An explicit function should do the work.
>
> OK by me for now, but after we get the identities straight,
> let's revisit this point.
It seems that my needs concernig vectors are completely different to what you intend. To
me it is very important to make
rebuilt( vector(5 a x - 6 b u, 5 a y - 6 b v) ); --> 5*a*vector(x, y) - 6*b*vector(u, v)
possible. Please have a look at the working example I posted earlier in this thread.
(%o12) vc(x,y,z) = vc(-2*(16*v+13*u+16)+3*(13*v+10*u+10)+3,
-5/3*(16*v+13*u+16)+8/3*(13*v+10*u+10)+2,
-4/3*(16*v+13*u+16)+7/3*(13*v+10*u+10)+1)
(%i13) vector_rebuild(%,[v,u]);
(%o13) vc(x,y,z) = v*vc(7,8,9)+u*vc(4,5,6)+vc(1,2,3)
(%o13) is clearly far more readable than (%o12).
Let me argue here: A CAS does generally not decide by itself whether 3*(x+y) or 3*x+3*y is
more simple. The user has to use factor or expand depending on what he wants. The
simplifier does not automatically expand.
> (%i7) 5*a*vector(x, y) - 6*b*vector(u, v);
> (%o7) vector(5 a x - 6 b u, 5 a y - 6 b v)
This is automatic expansion. I would not recommend it. The restructuring of vector
expressions in both ways (%i7) --> (%o7) AND (%o7) --> (%i7) should be possible.
Volker