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?
Also I cannot yet get d(x.y.z) to work, even though x.y is recognized
as sym_matrix.
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 ?
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.
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 12:16 PM, Andrej Vodopivec
<andrej.vodopivec at gmail.com> wrote:
> You can redefine the sym_matrixp function as
>
> 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 false$
>
> Andrej
>
>
>
> On Mon, Mar 2, 2009 at 2:17 PM, Paulo Grahl <pgrahl at gmail.com> wrote:
>> Thanks a lot!
>> This saved me probably from a couple of afternoons digging into maxima's help!
>> (as I am still learning it)
>>
>> one additional question:
>> If I
>> declare([ x,y] sym_matrix);
>> How do I make maxima recognize that x+y , x.y, x^^2, etc.
>> also are sym_matrix ?
>> thanks.
>> Paulo
>