differentiating Products

20 views
Skip to first unread message

Luke Oeding

unread,
Feb 14, 2023, 5:42:02 PM2/14/23
to Macaulay2
Has anyone already implemented the product rule for the class Product or similar?

Here is a minimal example: 

R = QQ[x,y]
f = Product({x,y,x+y})
diff(x,f)

I'd like to have results that are sums of products, not completely expanded expressions.

ztei...@boisestate.edu

unread,
Feb 15, 2023, 2:45:32 PM2/15/23
to Macaulay2
Will this work?

diff(RingElement,Product) := (d,p) -> sum(toList(apply(#p, k -> Product insert( k , diff(d,p#k) , toList delete(p#k,p) ))))

The business with "insert" just puts the differentiated factor back in the same position it came from. If you prefer it to be at the end (last factor in each summand) then this should work:

diff(RingElement,Product) := (d,p) -> sum toList apply(#p, k -> delete(p#k,p)*diff(d,p#k))

Zach
Reply all
Reply to author
Forward
0 new messages