Using part of output of an expression as a input of another expression
Subject: Using part of output of an expression as a input of another expression
From: Leo Butler
Date: Fri, 8 Jan 2010 11:25:39 +0000 (GMT)
On Thu, 7 Jan 2010, Cuneyt Ertal wrote:
< Hi I am a?newbie?maxima user. I want to use part of an output expression as a input of another expression.?
<
< (%i3) w(x,t):=sum(w[n](t)*sin(n*%pi*x),n,0,inf);
< (%o3) w(x,t):=sum(w[n](t)*sin(n*%pi*x),n,0,inf)
< (%i4) diff(w(x,t),x);
< (%o4) %pi*sum(n*w[n](t)*cos(%pi*n*x),n,0,inf)
< (%i5) diff(w(x,t),x,2);
< (%o5) -%pi^2*sum(n^2*w[n](t)*sin(%pi*n*x),n,0,inf)
< (%i6) diff(w(x,t),x,3);
< (%o6) -%pi^3*sum(n^3*w[n](t)*cos(%pi*n*x),n,0,inf)
< (%i7) diff(w(x,t),x,4);
< (%o7) %pi^4*sum(n^4*w[n](t)*sin(%pi*n*x),n,0,inf)
< (%i8) diff(w(x,t),t,2);
< (%o8) sum(('diff(w[n](t),t,2))*sin(%pi*n*x),n,0,inf)
< (%i9) f(x,t):=sum(f[n](t)*sin(n*%pi*x),n,0,inf);
< (%o9) f(x,t):=sum(f[n](t)*sin(n*%pi*x),n,0,inf)
< (%i10) diff(f(x,t),x,2);
< (%o10) -%pi^2*sum(n^2*f[n](t)*sin(%pi*n*x),n,0,inf)
< (%i11) diff(w(x,t),x,4)+diff(w(x,t),t,2)=sum(f[n](t)*sin(n*%pi*x),n,0,inf);
< (%o11) (sum(('diff(w[n](t),t,2))*sin(%pi*n*x),n,0,inf))+%pi^4*sum(n^4*w[n](t)*sin(%pi*n*x),n,0,inf)=sum(f[n](t)*sin(%pi*n*x),n,0,inf)
<
< i want to use %o11 without sums , like this;
<
< 'diff(w[n](t),t,2)*sin(%pi*n*x)+%pi^4*(n^4*w[n](t)*sin(%pi*n*x)=f[n](t)*sin(%pi*n*x)
<
< How can I do that?
You can use Maxima's scoping rules to redefine sum to achieve your aim:
(%i2) expr:(sum(('diff(w[n](t),t,2))*sin(%pi*n*x),n,0,inf))+%pi^4*sum(n^4*w[n](t)*sin(%pi*n*x),n,0,inf)=sum(f[n](t)*sin(%pi*n*x),n,0,inf);
(%o2) 'sum('diff(w[n](t),t,2)*sin(%pi*n*x),n,0,inf)
+%pi^4*'sum(n^4*w[n](t)*sin(%pi*n*x),n,0,inf)
= 'sum(f[n](t)*sin(%pi*n*x),n,0,inf)
(%i3) block(local(sum),sum([v]):=first(v),ev(expr,nouns));
(%o3) 'diff(w[n](t),t,2)*sin(%pi*n*x)+%pi^4*n^4*w[n](t)*sin(%pi*n*x)
= f[n](t)*sin(%pi*n*x)
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.