function r = subs(s,new,old)
%SUBS	Symbolic substitution in a symbolic expression or matrix.
%	SUBS(S,NEW) replaces all occurences of the symbolic variable in S by NEW.
%	SUBS(S,NEW,OLD) replaces all occurences of OLD in S by NEW.
%
%	Examples:
%	    subs sin(x) pi/3         =  'sin(1/3*pi)'
%	    subs sin(z) x+i*y        =  'sin(x+i*y)'
%	    f = 'F(a*r^2)'
%	    r = 'sqrt(x^2+y^2)'
%	    subs(f,r,'r')            =  'F(a*(x^2+y^2))'

%	Copyright (c) 1993-95 by The MathWorks, Inc.
%	$Revision: 1.6 $  $Date: 1995/03/01 21:38:57 $

if nargin < 3
   old = symvar(s);
end
if ~isstr(new)
   new = symrat(new);
end
r = maple('subs',[old '=' new],s);
