From munnari!earwax.oz.au!playboy@uunet.UU.NET Tue Mar 22 19:58:11 1988
Received: from newton.ncsa.uiuc.edu by spock.ncsa.uiuc.edu (3.2/NCSA-1.2)
	id AA13263; Tue, 22 Mar 88 19:58:09 CST
Return-Path: <munnari!earwax.oz.au!playboy@uunet.UU.NET>
Received: from uunet.UU.NET by newton.ncsa.uiuc.edu (3.2/NCSA-1.2)
	id AA11493; Tue, 22 Mar 88 19:57:07 CST
Received: from munnari.UUCP by uunet.UU.NET (5.54/1.14) with UUCP 
	id AA01682; Tue, 22 Mar 88 20:47:08 EST
Message-Id: <8803230147.AA01682@uunet.UU.NET>
Received: from earwax (via mimir) by munnari.oz with SunIII (5.5)
	id AA00522; Wed, 23 Mar 88 11:20:22 EST
Received: by earwax.uwa.oz (5.51/4.7)
	id AA04625; Mon, 21 Mar 88 15:52:52 WST
Date: Mon, 21 Mar 88 15:52:52 WST
From: munnari!earwax.uwa.oz.au!playboy@uunet.UU.NET (Kevin McIsaac)
To: steve@spock.ncsa.uiuc.edu
Subject: XIsot
Status: R

/**  Combine and Isolate Terms **/
/*A: G Watson, K McIsaac*/
/*S: University of Western Australia, Nedlands 6009, Australia*/
/*D: January, 1988 */
/*K: Isolate, Combine */
/*U: Feburary 1988, K McIsaac */

/*P: XIso, XESplit */
<<XIso
<<XESplit 
/* ESplit seems to be the rate determining step in this calculation */

/*: Isot[$expr,{$gpspec},($isospec:{{1}}),($partspec:Null)]
	Using Esplit, split $exp into two subexpressions using $gpspec
	as the criterian. Create an Isolate interactive procedure for
	each subtree labeled in $isospec. The default is to examine
	only the tree created from $gspec. If $partspec is given Isot
	is applied, using At, to each subexpression labeled by
	$partspec. Parts in $gpspec must have only one level.

	In effect Isot collects and isolates as a group the terms
	specified by the partspec $gspec in the subexpression of $expr
	labeled by $partspec. */

Isot_:Tier

Isot[$exp,$crit_=Listp[$crit],$child_=Listp[$child]] ::\
   S[Iso[ESplit[$exp,$crit,{'%root,$exp[0],$exp[0]}], $child],%root->$exp[0]]

Isot[$exp,$crit] :: Isot[$exp,$crit,{{1}}]

Isot[$exp,$crit,,$partspec_=Listp[$partspec]] :: \
   Isot[$exp,$crit,{{1}},$partspec]

Isot[$exp,$crit,$ispec,$partspec_=Listp[$partspec]] :: \
   At[Isot[$y,$crit,$ispec],$exp,$partspec]

/* Stop any screwy behaviour */
Isot[$exp,{}] :: $exp

/* The real principle behind Isot is to consider an expression as a tree.
Considering some subtree that we want to manipulate we partition the
the first level children of the subtree into two sets, those we want and
those we don't. We form a tree from each set using the root of the tree we
are interested in as the parent. We use Isolate to allow the user to look
at and manipulate the interesting tree. We then take the two trees and
connect them as siblings using the root of the tree. For example suppose
we have the tree f[a,1,b,c,4,x,5,y,105] and we are interested in the terms that
are numbers less that 10. We create the subtrees f[1,4,5] and f[a,b,c,x,y,105]
Isolate is applied to the first tree and then we form the new tree
f[Isolate[f[1,4,5]],f[a,b,c,x,y,105]].

Clearly algebraicly this is most appropriate for symmetric associative 
functions like Plus and Time. However we can use it in many other
situations. We need to exted the algorithm to take into account the
symmetery of the function involved, ie anti-symmetery */
/*E:

SMP 1.6.0
Tue Mar  1 11:46:51 1988


#I[1]::  <XIsot



#I[2]::  Isot[a+b+c+d,{{1},{4}}]

"1:1:1"

%I[1]::     %

%O[1]:   a + d

%I[2]::     La %

%O[2]:   La (a + d)

%I[3]::  Ret[]



#O[2]:   b + c + La (a + d)

#I[3]::  S[%,'Plus->'Mult]

#O[3]:   b c La (a + d)

#I[4]::  Isot[%,{{2},{4}}]

"1:1:1"

%I[1]::     %

%O[1]:   c (a + d)

%I[2]::     Ex[%]

%O[2]:   a c + c d

%I[3]::  Ret[]



#O[4]:   b La (a c + c d)

#I[5]::  Isot[a^2-b^2+f[a]-g,{$a^2}]

"1:1:1"

%I[1]::     %

	  2    2
%O[1]:   a  - b

%I[2]::     Fac[%]

%O[2]:   (a - b) (a + b)

%I[3]::  Ret[]



#O[5]:   -g + f[a] + (a - b) (a + b)

#I[6]::  Isot[a^2+a^3+f[a]-g,{a^2,$a^3}]

"1:1:1"

%I[1]::     %

	  2    3
%O[1]:   a  + a

%I[2]::     Fac[%]

	  2
%O[2]:   a  (1 + a)

%I[3]::  Ret[]



		      2
#O[6]:   -g + f[a] + a  (1 + a)

#I[7]::  <end>
*/

