collect diff terms
- Subject: collect diff terms
- From: Aleksas Domarkas
- Date: Wed, 18 Dec 2013 12:18:59 +0200
??????? ??????? arkhipovdm at yandex.ru
on Thu Dec 12 03:58:47 CST 2013 wrote:
>Good morning!
>Could you help me?
>How can I collect differential terms like that: diff(h,t)*u+h*diff(u,t)
=> diff(hu,t)
>Thank you much.
We define "dcoll":
(%i1) load(antid)$
(%i2) dcoll(f,h,t):=block([],
antidiff(f,t,h),
'diff(%%,t)
)$
Example 1
(%i3) depends([h,u],t);
(%o3) [h(t),u(t)]
(%i4) 'diff(h,t)*u+h*'diff(u,t);
(%o4) h*('diff(u,t,1))+('diff(h,t,1))*u
(%i5) dcoll('diff(h,t)*u+h*'diff(u,t),h,t);
(%o5) 'diff((h*u),t,1)
Example 2
(%i6) depends(u,x);
(%o6) [u(x)]
(%i7) diff(u,x)*sin(x)+u*cos(x);
(%o7) ('diff(u,x,1))*sin(x)+u*cos(x)
(%i8) dcoll(%,u,x);
(%o8) 'diff((u*sin(x)),x,1)
best
Aleksas D