Thanks.
I'm trying to work my way trough the "manydots" idea.
By the way, I got rid of the x.x=x^^2 problem by setting
dotexptsimp:false before the computations are performed.
--Paulo
Paulo Gustavo Grahl, CFA
------------------------------------------
pgrahl at gmail.com
pgrahl at fgvmail.br
+55(21) 8809-9254
www.linkedin.com/in/pgrahl
------------------------------------------
On Mon, Mar 2, 2009 at 2:47 PM, Richard Fateman <fateman at cs.berkeley.edu> wrote:
> Paulo Grahl wrote:
>>
>> great!
>> I am now facing the following problem:
>>
>> declare(sym_matrix,feature);
>> sym_matrixp(expr):=
>> ?if atom(expr) then featurep(expr,sym_matrix)
>> ?else if member(part(expr,0),["+","-","."]) then
>> ? ?every(sym_matrixp,args(expr))
>> ?else if part(expr,0)="^^" then sym_matrixp(first(expr))
>> ?else if is(equal(part(expr,0),d)) then every(sym_matrixp,args(expr))
>> ?else false$
>>
>> matchdeclare([C,D],sym_matrixp);
>> declare(d,linear);
>> block([simp:false], tellsimp(d(C.D),d(C).D + C.d(D)));
>> declare(d,linear);
>> block([simp:false], tellsimp(d(C.D),d(C).D + C.d(D)));
>>
>> declare([x,y],sym_matrix);
>>
>> When I type
>> (%i8) d(y.x);
>> (%o8) ? ? ? ? ? ? ? ? ? ? ? ? d(y) . x + y . d(x)
>> OK
>> (%i10) d(y.(x+y));
>> (%o10) ? ? ? ? ? ? ? ?d(y) . (y + x) + y . (d(y) + d(x))
>> OK
>> BUT,
>> (%i15) d(x.x);
>> (%o15) d(x^^2)
>>
>> Any idea on how I can evaluate the function d() before x.x is
>> simplified to x^^2?
>>
>
> You write additional rules for xx^^n . ? or actually, ?d(xx^n).
>
>> Also I cannot yet get d(x.y.z) to work, even though x.y is recognized
>> as sym_matrix.
>>
>
> That is because x.y.z ? is ? ?a multiplication of 3 items. ?it is not
> (x.y).z ? ?or x.(y.z).
>
>> How do I change the rule tellsimp(d(C.D),d(C).D + C.d(D)) to make it
>> work with arbitrary number of elements ?
>>
>
> try something like this:
>
> matchdeclare(manydots,manydotsp),
>
> defrule(d(manydots), ?.... whatever the result is supposed to be...)
>
> manydotsp(r):= if (not(atom(r)) and op(r)=".") then true;
>
>
>> Thanks again. Please feel free to guide me to some texts over the web
>> where I can dig deeper into using rules and patterns to avoid
>> bothering too much my list colleagues.
>>
>
> You might look at
> http://www.cs.berkeley.edu/~fateman/papers/partition.pdf
>
> Also, you can write about your experience to help others!
>
>
> RJF
>
>