Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:09.  Memory: start 0001BCE0, length 476860.

Command line: +1 Examples.e Xax


C Example 1

	Z XX = (a + b)^2

	*begin
 
XX =  + 2*a*b + a^2 + b^2 + 0.
 

Begin. Time 0 sec.

	B a

	Z XX= (a + b)^2

	*end
 
XX =  + b^2
 
 + a
  * ( 2*b )
 
 + a^2 + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:11.  Memory: start 0001BCE0, length 476860.


C Example 2.

> P output   !Only the first two characters of 'output' are significant.

	Digits 3
	Rationalization 3		! 0 leads to no rationalization attempt.

	Z XX=3.14 + 1/3*a1 + 7.1357689E20*a2	!E20 or E+20 implies 10^20.

	*yep
 
XX =  + 22/7 + 1/3*a1 + .714E+21*a2 + 0.
 

	Digits			!This restores to the default option, 5 digits.
	Rationalization		!Default: 22 digits, with check.

	*end
 
XX =  + 157/50 + 1/3*a1 + .71358E+21*a2 + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:13.  Memory: start 0001BCE0, length 476860.


C Example 3.

> BLOCK text{xx,yy}
> C This argument is substituted in a call: 'xx'.
>   This not: xx.
>   Arguments can be glued together: 'xx''yy'.
> ENDBLOCK

> BLOCK lines{A,B}
> 'A'C line 1
> 'A'  line 2
> 'B'  line 3
> ENDBLOCK

C Calling block text:

> text{yes,sir}
C This argument is substituted in a call: yes.
  This not: xx.
  Arguments can be glued together: yessir.

	DELETE text

C Calling lines twice:

> lines{,~}
C line 1
  line 2
> lines{~,} 
  line 3

	DO var=1,3,2
> P input			!Normally only the first DO round is printed.
C value of var: 1
	ENDDO
> P input			!Normally only the first DO round is printed.
C value of var: 3
	ENDDO

	DO var=-1,0		!The third number is 1 by default.
> P input
C value of var: %1.
C This may be part of a name, for example XX%1, or an index,
  for example YY(3+%1). In the last case Schoonschip will interpret
  the % sign as minus if not on a C line and correctly work out the
  number.
	ENDDO
> P input
C value of var: 0.
C This may be part of a name, for example XX0, or an index,
  for example YY(3+0). In the last case Schoonschip will interpret
  the % sign as minus if not on a C line and correctly work out the
  number.
	ENDDO

	*end

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:15.  Memory: start 0001BCE0, length 476860.


C Example 4.

	A a1,a2,a3		!Algebraic symbol list.
	F f1,f2,f3		!Functions.
	I mu,nu			!Indices.
	V p,q,k			!Vectors.

	Z XX = p(mu)*{ a3^-20*a1*q(mu) + a2*a1^7*D(mu,nu)*k(nu)

		+ a3*f2(mu,k,q)*f1}		!Note the use of {}.

		+ q(mu)*{a3*a2*a1 + f3*f2*f1}

	*end
 
XX = 
  + a1*a3^-20*pDq + a1^7*a2*pDk
 
 + q(mu)
  * ( a1*a2*a3 )
 
 + f2(p,k,q)*f1
  * ( a3 )
 
 + f3*f2*f1*q(mu) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:16.  Memory: start 0001BCE0, length 476860.


C Example 5.

	A a1,a2=i,a3=c,a4=c,a5=i=3
	V p,q=z,k

	Z XX = Conjg(a1 + a2 + a3 + a4 + a5)
	Z YY = Conjg(a3C + a4C)
	Z ZZ = (a1 + a5)^5
	Z AA = p(mu)*{p(mu) + q(mu)} + D(mu,3)*{p(mu) + q(mu)} + pDk 

	Oldnew a4C=b4,k=K

	*end
 
XX =  + a1 - a2 + a3C + b4 - a5
 
YY =  + a3 + a4
 
ZZ =  + 10*a1^3*a5^2 + 5*a1^4*a5 + a1^5
 
AA =  + p(3) + pDp + pDK + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:18.  Memory: start 0001BCE0, length 476860.


C Example 6.

	I mu,nu,la,ka

	Z  XX = D(mu,nu)*f1(a1,a2,mu)*f2(a3,a4,nu)
	      + f1(a1,a2,mu)*f2(a3,a4,nu)*D(mu,nu)

	Z  YY = D(la,ka)*f1(a1,a2,la)*f2(a3,a4,ka)
	      + f1(a1,a2,la)*f2(a3,a4,ka)*D(la,ka)

	Sum,la,ka

	*end
 
XX = + f1(a1,a2,mu)*f2(a3,a4,mu)
 
 + f1(a1,a2,nu)*f2(a3,a4,nu)
 
YY = + 2*f1(a1,a2,Naa)*f2(a3,a4,Naa) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:20.  Memory: start 0001BCE0, length 476860.


C Example 7.

	A a1,a2=i,a3=c
	F f1,f2=i,f3=c,f4=u

	Z xx=Conjg{ f1(a1,a2,a3)*f2(a1,a2,a3,f3)*f4(a1,a2,a3) }

	*end
 
xx = - Conjg(f4(a1,a2,a3))*f2(a1,-a2,a3C,f3C)*f1(a1,-a2,a3C) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:21.  Memory: start 0001BCE0, length 476860.


C Example 8.

	Digits 20
	Ratio 0

	Z xx= DS(J,0,20,(1.),(1/J))

	*begin
 
xx =  + .27182818284590452353D+1 + 0.
 

Begin. Time 1 sec.

	Digits
	Ratio

	Z yy = DS(J,0,5,(X^J),(1/J))

	*end
 
yy =  + 1 + X + 1/2*X^2 + 1/6*X^3 + 1/24*X^4 + 1/120*X^5 + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:23.  Memory: start 0001BCE0, length 476860.


C Example 9.

	X EXP(y) = DS(J,0,6,(y^J),(1/J))

	Z COS = { EXP{ (i*x) } + EXP{ -(i*x) } }/2

	*end
 
COS =  + 1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:25.  Memory: start 0001BCE0, length 476860.


C Example 10.

	B a11,a21,a31

	D rc(n)=a11,a12,a13,
		a21,a22,a23,
		a31,a32,a33

	X matrix(n,m)=rc(3*n+m-3)

	Z xxx = DS{J1,1,3,(DS{J2,1,3,(DS{J3,1,3,
		{ DP(J1,J2,J3)*matrix(J1,1)*matrix(J2,2)*matrix(J3,3) }
		} ) } ) }

	*begin
 
xxx = 
 + a11
  * ( a22*a33 - a23*a32 )
 
 + a21
  * ( - a12*a33 + a13*a32 )
 
 + a31
  * ( a12*a23 - a13*a22 ) + 0.
 

Begin. Time 0 sec.

	B a11,a21,a31,b11,b21,b31

	D ra(n)=a11,a12,a13,
		a21,a22,a23,
		a31,a32,a33

	D rb(n)=b11,b12,b13,
		b21,b22,b23,
		b31,b32,b33

	X matrix(n,m,ra)=ra(3*n+m-3)

	X DET(ra) = DS{J1,1,3,(DS{J2,1,3,(DS{J3,1,3,
		{ DP(J1,J2,J3)*matrix(J1,1,ra)*matrix(J2,2,ra)*matrix(J3,3,ra) }
		} ) } ) }

	Z detb=DET(rb)

	Z deta=DET(ra)

	*begin
 
detb = 
 + b11
  * ( b22*b33 - b23*b32 )
 
 + b21
  * ( - b12*b33 + b13*b32 )
 
 + b31
  * ( b12*b23 - b13*b22 )
 
deta = 
 + a11
  * ( a22*a33 - a23*a32 )
 
 + a21
  * ( - a12*a33 + a13*a32 )
 
 + a31
  * ( a12*a23 - a13*a22 ) + 0.
 

Begin. Time 0 sec.

	F f1

	B b11,b21,b31

	D ra(n)=(a1-a2),0,
		0,(a1+a2)

	D rb(n)=b11,b12,b13,
		b21,b22,b23,
		b31,b32,b33

	D rc(n)=c11
	X matrix(k,n,m,f1)=f1(k*n+m-k)

	D DET(n,f1) = f1(1),
	   DS{J1,1,2,(DS{J2,1,2,
	     { DP(J1,J2)*matrix(n,J1,1,f1)*matrix(n,J2,2,f1) }
	 	} ) }
	  ,
	   DS{K1,1,3,(DS{K2,1,3,(DS{K3,1,3,
	     { DP(K1,K2,K3)*matrix(n,K1,1,f1)*matrix(n,K2,2,f1)*matrix(n,K3,3,f1) }
		} ) } ) }

	Z deta=DET(2,ra)

	Z detb=DET(3,rb)

	Z detc=DET(1,rc)

	*end
 
deta =  + a1^2 - a2^2
 
detb = 
 + b11
  * ( b22*b33 - b23*b32 )
 
 + b21
  * ( - b12*b33 + b13*b32 )
 
 + b31
  * ( b12*b23 - b13*b22 )
 
detc =  + c11 + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:27.  Memory: start 0001BCE0, length 476860.


C Example 11.

	T List(n)=a,b,c

	F f

	Z compl = DS(J,1,3,{ f(List(J)) } )

	*begin
 
compl = + f(a)
 
 + f(b)
 
 + f(c) + 0.
 

Begin. Time 0 sec.

	A x=c

	T r1(n)=a11,a12,a13
	T r2(n)=a21,a22,a23
	T r3(n)=a31,a32,a33

	T matr(n,m)=r1,r2,r3

	T weird(n,a1,a2)=Conjg(a1+a2),Integ(3*a2)

	X XX(a1,a2)=a2*a1

	Z sqa13 = DS(J,1,3,{f1(matr(1,J))*f1(matr(J,3))} )

	Z weirdo=XX(weird(1,x,7),weird(2,x,7))

	*end
 
sqa13 = + f1(a11)*f1(a13)
 
 + f1(a12)*f1(a23)
 
 + f1(a13)*f1(a33)
 
weirdo =  + 147 + 21*xC + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:29.  Memory: start 0001BCE0, length 476860.


C Example 12.

> P lists

	Common yyy,ccc(0)

	Z xxx(a,b)=(a+b)^2
	Z ccc(3,a,b)=(a+b)^3
	Z ccc(4,a,b)=(a+b)^4

	Keep xxx

	*next


A i=i, a, b

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC

E yyy=C, ccc(0)=C
 
xxx(a,b) =  + 2*a*b + a^2 + b^2
 
ccc(3,a,b) =  + 3*a*b^2 + 3*a^2*b + a^3 + b^3
 
ccc(4,a,b) =  + 4*a*b^3 + 6*a^2*b^2 + 4*a^3*b + a^4 + b^4 + 0.
 

	F f1,f2
	V p

	Z yyy(p)=xxx(c,d) + p(nu)*f2(mu)

	Sum mu,nu

	*begin


V p

A i=i, a, b, c, d

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC, f1, f2

E yyy=C, ccc(0)=C, xxx, ccc(3)=C, ccc(4)=C
 
yyy(p) =  + 2*c*d + c^2 + d^2
 
 + f2(Naa)*p(Nab) + 0.
 

Begin. Time 0 sec.
	Write fileC
	*begin


A i=i

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC

E yyy=C, ccc(0)=C, ccc(3)=C, ccc(4)=C

Begin. Time 1 sec.

	V q

	Z zzz=a1*yyy(q)

	Z Abc=xxx(a,b)

	Delete ccc,yyy		!The actual delete when this section is done.

	*begin


V q

A i=i, a1, a, b

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC, xxx

E yyy, ccc(0), ccc(3), ccc(4)


V q, p

A i=i, a1, a, b, c, d

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC, xxx, f2

E yyy, ccc(0), ccc(3), ccc(4)
 
zzz =  + 2*a1*c*d + a1*c^2 + a1*d^2
 
 + f2(Naa)*q(Nab)
  * ( a1 )
 
Abc = + xxx(a,b) + 0.
 

Begin. Time 1 sec.

	Z xyz=ccc(3,e,f)

	*end		!The reader may want to delete fileC at this point.


A i=i, e, f

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC, ccc
 
xyz = + ccc(3,e,f) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:31.  Memory: start 0001BCE0, length 476860.


C Example 13.

	Z integr = a*x^2 +b*x

L 1	Id,x^n~ = x2^(n+1)/(n+1) - x1^(n+1)/(n+1)

	*begin
 
integr =  + 1/3*a*x2^3 - 1/3*a*x1^3 + 1/2*b*x2^2 - 1/2*b*x1^2 + 0.
 

Begin. Time 1 sec.

	Z integr = (a*x^2 + b*x + c)*dx

L 2	Id,x^n~*dx = x2^(n+1)/(n+1) - x1^(n+1)/(n+1)

L 2	Al,dx = x2 - x1

	*begin
 
integr =  + 1/3*a*x2^3 - 1/3*a*x1^3 + 1/2*b*x2^2 - 1/2*b*x1^2
  + c*x2 - c*x1 + 0.
 

Begin. Time 1 sec.

C Method to integrate expressions of the form x^n*sin(x) or x^n*cos(x).
C The method is based on the equation (n even):
C Integral( x^n*sin(x)) = - n! * cos(x)
     + Integral(  sin(x) * n * { x^(n-1) - (n-2)*(n-1)*x^(n-3) + ...} )
     + Integral( -cos(x) * { x^n - (n-1)*n*x^(n-2) + ...} )
  and similar equations for odd n and also cos(x).
  The X-expressions Coefa and Coefb corresponds to the above sums enclosed
  in curly brackets.
  Below the function DK is used to separate even and odd n cases. Remember
  that Integ converts and truncates its argument to a short integer in the
  range -128, 127.

	X Coefa(n,m,x)=DS(j,0,m,{ x^(n-2*j-1) } , { -(n-2*j)*(n-2*j+1) } )
	X Coefb(n,m,x)=DS(k,0,m,{ x^(n-2*k) } , { -(n-2*k+2)*(n-2*k+1) } )

	X Icos(n,x) =
	   DK(2*Integ(n/2),n)*{
	    - DB(n)*sin(x)				! n even.
	    + cos(x)*n*Coefa(n,(n-1)/2,x)
	    + sin(x)*Coefb(n,(n-1)/2-1,x)  }

	 + DK(2*Integ(n/2),n+1)*{
	      DB(n)*cos(x)				! n odd.
	    + cos(x)*n*Coefa(n,(n-1)/2-1,x)
	    + sin(x)*Coefb(n,(n-1)/2,x)    }

	X Isin(n,x) =
	   DK(2*Integ(n/2),n)*{
	      DB(n)*cos(x)				! n even.
	    + sin(x)*n*Coefa(n,(n-1)/2,x)
	    - cos(x)*Coefb(n,(n-1)/2-1,x)  }

	 + DK(2*Integ(n/2),n+1)*{
	    + DB(n)*sin(x)				! n odd.
	    + sin(x)*n*Coefa(n,(n-1)/2-1,x)
	    - cos(x)*Coefb(n,(n-1)/2,x)    }

	Z xx = x^8*cos(x)

L 1	Id,x^n~*cos(x) = Icos(n,x2) - Icos(n,x1)
L 1	Al,x^n~*sin(x) = Isin(n,x2) - Isin(n,x1)

	*end
 
xx = 
 + sin(x2)
  * ( - 40320 + 1680*x2^4 - 56*x2^6 + x2^8 )
 
 + sin(x1)
  * ( 40320 - 1680*x1^4 + 56*x1^6 - x1^8 )
 
 + cos(x2)
  * ( - 40320*x2 + 6720*x2^3 - 336*x2^5 + 8*x2^7 )
 
 + cos(x1)
  * ( 40320*x1 - 6720*x1^3 + 336*x1^5 - 8*x1^7 ) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:33.  Memory: start 0001BCE0, length 476860.


C Example 14.

	V p,q
	A a,b,c,d,e,f,g,h
	I mu,nu
	F f1,f2,f3

	X expr=f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*
		{ a^7 + a^-7 + a^2 + pDq^2 + pDp + p(mu) + p(nu) }

	*fix

Begin. Time 1 sec.

C Class 0, no keyword.

	Z xxx=expr

L 3	Id,f1(a1~,a2~)=a1^10*a2^20

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)
  * ( a^2*g^10*h^20 + a^7*g^10*h^20 + a^-7*g^10*h^20 + g^10*h^20*pDp
   + g^10*h^20*pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*p(mu)
  * ( g^10*h^20 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*p(nu)
  * ( g^10*h^20 ) + 0.
 

Begin. Time 1 sec.

C Class 0, keyword Always.

	Z xxx=expr

L 3	Id,Always,f1(a1~,a2~)=a1^10*a2^20

	*begin
 
xxx = 
 + f2(a,c,q)*f3(d,e)
  * ( a^3*b^20*g^10*h^20 + a^10*b^20*g^10*h^20*pDp + a^10*b^20*g^10
  *h^20*pDq^2 + a^12*b^20*g^10*h^20 + a^17*b^20*g^10*h^20 )
 
 + f2(a,c,q)*f3(d,e)*p(mu)
  * ( a^10*b^20*g^10*h^20 )
 
 + f2(a,c,q)*f3(d,e)*p(nu)
  * ( a^10*b^20*g^10*h^20 ) + 0.
 

Begin. Time 1 sec.

C Class 1, keyword Multi.

	Z xxx=expr

L 3	Id,Multi,a^3 = xyz + hij

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( 2*a*xyz*hij + a*xyz^2 + a*hij^2 + a^2 + a^-7 + pDp + pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 2, exponent 1, no keyword.

	Z xxx=expr

L 3	Id,pDq = XYZ + HIJ

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + 2*XYZ*HIJ + XYZ^2 + HIJ^2 + pDp )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 3, no keyword.

	Z xxx=expr

L 3	Id,a^2 = a1^7/15

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^7 + a^-7 + 1/15*a1^7 + pDp + pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 5.

	Z xxx=expr

L 3	Id,p(mu) = - q(mu)

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu)
 
 - f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*q(mu) + 0.
 

Begin. Time 1 sec.

C Class 6.

	Z xxx=expr

L 3	Id,p(mu~) = - q(mu)

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 - f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*q(mu)
 
 - f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*q(nu) + 0.
 

Begin. Time 1 sec.

C Class 7, keyword Funct.

	Z xxx=expr

L 3	Id,Funct,a = a27

L 4	Id,f1(a1~,a2~,a3~) = 200*a1*a2*a3
L 4	Al,f2(a1~,a2~,a3~) = a1^10*a2^11*a3^12

	*begin
 
xxx = 
 + f3(d,e)*f1(g,h)
  * ( 200*a^2*b*c^11*a27^11*p(1)*q(12) + 200*a^7*b*c^11*a27^11*p(1)
  *q(12) + 200*a^-7*b*c^11*a27^11*p(1)*q(12) + 200*b*c^11*a27^11*p(1)
  *q(12)*pDp + 200*b*c^11*a27^11*p(1)*q(12)*pDq^2 )
 
 + f3(d,e)*f1(g,h)*p(mu)
  * ( 200*b*c^11*a27^11*p(1)*q(12) )
 
 + f3(d,e)*f1(g,h)*p(nu)
  * ( 200*b*c^11*a27^11*p(1)*q(12) ) + 0.
 

Begin. Time 1 sec.

C Class 8, keyword Once.

	Z xxx=expr

L 3	Id,Once,a^2 = XXX

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^5*XXX + a^-7 + XXX + pDp + pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 9.

	Z xxx=expr

L 3	Id,a^2*f2(a1~,c,p~) = F2(a1,c,p)

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^7 + a^-7 + pDp + pDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu)
 
 + f1(a,b,p)*F2(a,c,q)*f3(d,e)*f1(g,h) + 0.
 

Begin. Time 1 sec.

C Class 10.

	Z xxx=expr

L 3	Id,f1~(a,b~,p~) = F(a,b,p)

	*begin
 
xxx = 
 + F(a,b,p)*F(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 + F(a,b,p)*F(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + F(a,b,p)*F(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 11, keyword Adiso.

	Z xxx = expr

L 3	Id,Adiso,f1(g,h)*f1(a~,b~,c~) = F1(a,b,c,g,h)

	*begin
 
xxx = 
 + F1(a,b,p,g,h)*f2(a,c,q)*f3(d,e)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 + F1(a,b,p,g,h)*f2(a,c,q)*f3(d,e)*p(mu)
 
 + F1(a,b,p,g,h)*f2(a,c,q)*f3(d,e)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 12, keyword Ainbe.

	Z xxx=expr

L 3	Id,Ainbe,f1(g,h)*f1(a~,b~,c~) = F1(a,b,c,g,h)
L 4	Id,Ainbe,f1(a~,b~,c~)*f1(g,h) = F2(a,b,c,g,h) 

	*begin
 
xxx = 
 + f2(a,c,q)*f3(d,e)*F2(a,b,p,g,h)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 + f2(a,c,q)*f3(d,e)*F2(a,b,p,g,h)*p(mu)
 
 + f2(a,c,q)*f3(d,e)*F2(a,b,p,g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 13.

	Z xxx=expr

L 3	Id,f1(x~,b,p)*f2(x~,c,q) = F(x,b,p,c,q)

	*begin
 
xxx = 
 + F(a,b,p,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + pDp + pDq^2 )
 
 + F(a,b,p,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + F(a,b,p,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 15, keyword Dotpr.

	Z xxx=expr

L 3	Id,Dotpr,p(mu~) = - q(mu)

	*begin
 
xxx = 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)
  * ( a^2 + a^7 + a^-7 + qDq + qDq^2 )
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(mu)
 
 + f1(a,b,p)*f2(a,c,q)*f3(d,e)*f1(g,h)*p(nu) + 0.
 

Begin. Time 1 sec.

C Class 16, keyword Funct.

	Z xxx=expr

L 3	Id,Funct,p(mu~) = - F1(a,b,mu)

	*end
 
xxx = 
 + f1(a,b,Naa)*f2(a,c,q)*f3(d,e)*f1(g,h)*F1(a,b,Naa)
  * ( - a^2 - a^7 - a^-7 - pDp - pDq^2 )
 
 - f1(a,b,Naa)*f2(a,c,q)*f3(d,e)*f1(g,h)*F1(a,b,Naa)*p(mu)
 
 - f1(a,b,Naa)*f2(a,c,q)*f3(d,e)*f1(g,h)*F1(a,b,Naa)*p(nu) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:36.  Memory: start 0001BCE0, length 476860.


C Example 15.

  Integration of polynomium.

	A a,b,c,d,e,x

	Z xxx = a*x^2 + b*x + c + d/x + e/x^2

L 1	IF NOT x^-1=[Log(x)]
	AND NOT x^n~=x^(n+1)/(n+1)
L 1	Al,Addfa,x
	ENDIF

	*end
 
xxx =  + 1/3*a*x^3 + 1/2*b*x^2 + c*x + d*[Log(x)] - e*x^-1 + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:38.  Memory: start 0001BCE0, length 476860.


C Example 16.

	V p,q
	F F
	I mu=N,nu=N

	Z xx= pDp^2 * pDq^3 * F1(p,p,q,p) * p(mu) * q(nu)

L 1	Id,All,p,N,F
> P output
	*yep
 
xx = + F1(Naa,Nab,q,Nac)*F(mu,Nad,Nad,Nae,Nae,q,q,q,Naa,Nab,Nac)*q(nu) + 0.
 
C Showing the dimensionality of the created indices:

L 1	Id,F(i1~,i2~,i3~,i4~,i5~,i6~,i7~,i8~,i9~,i10~,i11~)=
	 F(i1,i2,i3,i6,i7,i8,i9,i10,i11)*D(i4,i5)
	*begin
 
xx = + F1(Naa,Nab,q,Nac)*F(mu,Nad,Nad,q,q,q,Naa,Nab,Nac)*q(nu)
  * ( N ) + 0.
 

Begin. Time 0 sec.

C A more realistic example.

	I al,be,mu,nu
	A N,N_
	V p,k
	F F,F20,F22

	Z xx = G(1,1,al,be,p,al,be,p)

L 1	Id,All,p,N,F
> P output
	*yep
 
xx = + G(1,1,al,be,Naa,al,be,Nab)*F(Naa,Nab) + 0.
 
L 1	Id,F(i1~,i2~) = D(i1,i2)*F20(k) + k(i1)*k(i2)*F22(k)
	*end
 
xx = + G(1,1,al,be,Naa,al,be,Naa)*F20(k)
 
 + G(1,1,al,be,k,al,be,k)*F22(k) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:40.  Memory: start 0001BCE0, length 476860.


C Example 17.

	V p,q,k
	I mu
	A a,b,c,d,e,f,g,h
	F F1,F2,F3

	Z xx = F1(e,d,c,b,a) + F2(e,d,c,b,a) + F3(e,d,c,b,a)
		+ F2(-125,-30,-1,0,30,125)
		+ F2(pDq,pDk,kDq,p(3),q(2),F2,7,mu,p,a)
		+ f1(e,f,g,d,a,b,c,h,k)

L 1	Id,Asymm,F1,2,3,4,F2,F3,4,5
L 2	Al,Asymm,f1:1-3:5-7:

	*end
 
xx = 
 - F1(e,b,c,d,a)
 
 + F2(mu,p,F2,a,7,p(3),q(2),pDq,pDk,qDk)
 
 + F2(a,b,c,d,e)
 
 - F2(0,30,125,-125,-30,-1)
 
 - F3(e,d,c,a,b)
 
 - f1(a,b,c,d,e,f,g,h,k) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:41.  Memory: start 0001BCE0, length 476860.


C Example 18.

	A a1,a2,a3,a4,alt1,agt2,aeq15,ai12

	Z xxx= 0.5*a1 + 1.5*a2 + 2.5*a3 + 1.E-20*a4

L 1	IF Coef,lt,1.
L 1	Al,Addfa,alt1
	ENDIF

L 2	IF Coef,gt,2.
L 2	Al,Addfa,agt2
	ENDIF

L 3	IF Coef,eq,1.5
L 3	Al,Addfa,aeq15
	ENDIF

L 4	IF Coef,ib,1,2
L 4	Al,Addfa,ai12
	ENDIF

L 5	IF Coef,lt,1E-15	!Delete the term if coefficient < 1E-15.
L 5	Al,Addfa,0
	ENDIF

	*end
 
xxx =  + 1/2*a1*alt1 + 3/2*a2*aeq15*ai12 + 5/2*a3*agt2 + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:43.  Memory: start 0001BCE0, length 476860.


C Example 19.

	A a1,a2,a3,a4,a5
	F F1,F2,F3

	Z xx= F3(a1,a2)*F1(a1,a2,a3)*F1(a4,a5)
	 + F1(a1,a2,a4)*F2(a1,a2,a3)*F1(a1,a2,a3)
	 + F3(a1,a4)*F2(a1,a2,a3)*F1(a1,a2,a4)*F2(a3,a4,a5)

L 1	Id,Commu,F1,F3

	*end
 
xx = 
 + F1(a4,a5)*F1(a1,a2,a3)*F3(a1,a2)
 
 + F2(a1,a2,a3)*F1(a1,a2,a3)*F1(a1,a2,a4)
 
 + F2(a1,a2,a3)*F2(a3,a4,a5)*F1(a1,a2,a4)*F3(a1,a4) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:45.  Memory: start 0001BCE0, length 476860.


C Example 20.

	F F1,F2
	A a,b,c,d

	Z xx =	  F1("c,"b,"a,/,"e,*,a1)
		+ F1("c,"b,"a,/,"e,*,a1,*,xy)
		+ F1("c,"b,"a,/,"e,*,a1,*,xy,*,a2)
		+ F1("c,"b,"a,/,"e,*,a1,*,xy,*,a2,*,xz)

		+ F2("a,"b,/,"F,*,x,*,y,*,z1)
		+ F2("b,"a,/,"F,*,x,*,y,*,z1)
		+ F2("F,"c,"b,"a,*,*,z,*,y,*,x)
		+ F2("F,"c,"b,"a,*,*,z,*,yp,*,x)


L 1	Id,Compo,<AVIFXA>,F1,<FF>,F2
L 2	Id,Always,F2(F1~,a~,b~,c~,d~,e~) = F1(a,b,c)
L 3	Id,F1~(a~,b~,z1) = F1(a,b)
	*begin
 
xx = 
 + F1(abce,a1)
 
 + F1(abce,xy,a1)
 
 + F1(abce,a2,xy,a1,xz)
 
 + F1(abce,a2,xy,a1)
 
 + abF(x,y)
 
 + abF(y,x)
 
 + Fabc(x,y,z)
 
 + Fabc(x,yp,z) + 0.
 

Begin. Time 0 sec.
	C
		   j1
	i1   ---0-------0---  i3
	     j4	|	|j2
		|	|
	i2   ---0-------0---  i4
		   j3


	T Ch(n)="A,"B,"C
	T Cg(n)="A,"C,"B

	F BC,ABC
	A i1,i2,i3,i4,j1,j2,j3,j4

	Z solu = square("A,"A,"A,"A)

L 1	Id,square(c1~,c2~,c3~,c4~) = DS{L1,1,3,(DS{L2,1,3,
		(DS{L3,1,3,(DS{L4,1,3,(
			v3(c1,Ch(L1),Cg(L4),*,i1,*,-j1,*,j4)*
			con(Ch(L1),Cg(L1),*,j1,*,-j1)*
			v3(c3,Cg(L1),Ch(L2),*,-i3,*,j1,*,-j2)*
			con(Ch(L2),Cg(L2),*,j2,*,-j2)*
			v3(c4,Cg(L2),Ch(L3),*,-i4,*,j2,*,-j3)*
			con(Ch(L3),Cg(L3),*,j3,*,-j3)*
			v3(c2,Cg(L3),Ch(L4),*,i2,*,j3,*,-j4)*
			con(Ch(L4),Cg(L4),*,j4,*,-j4)
			) } ) } ) } ) }

L 6	Id,Compo,<F>,v3,con
L 7	Id,v3(f1~,a1~,a2~,a3~) = f1(a1,a2,a3)
L 7	Al,con(f1~,a1~,a2~) = f1(a1)

	*end
 
solu = 
 + ABC(i1,j4,-j1)*BC(-j1)*ABC(-i3,j1,-j2)*BC(-j2)*ABC(-i4,j2,-j3)*BC(-j3)
  *ABC(i2,j3,-j4)*BC(-j4)
 
 + ABC(i1,-j1,j4)*BC(j1)*ABC(-i3,-j2,j1)*BC(j2)*ABC(-i4,-j3,j2)*BC(j3)
  *ABC(i2,-j4,j3)*BC(j4) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:47.  Memory: start 0001BCE0, length 476860.


C Example 21.

	A x,y
	T tt(n) = "1,"2,"3,"4,"5

C Here a complicated way to make
	C	pow(x) = a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5.

	Z pow(x) = DS(J,1,5,{f1(/,"a,tt(J))*x^J})

L 2	Id,Compo,f1
L 3	Id,f1(y~) = y

	Keep pow
	*next
 
pow(x) =  + x*a1 + x^2*a2 + x^3*a3 + x^4*a4 + x^5*a5 + 0.
 

	Z xx = pow(x)

L 2	Id,Count,3,x,1

	Keep pow
	*next
 
xx =  + x^3*a3 + x^4*a4 + x^5*a5 + 0.
 

	Z xx = pow(y)

L 2	Id,Count,f1,y,2,a3,10

	Keep pow
	*next
 
xx = 
 + f1(2)
  * ( y*a1 )
 
 + f1(4)
  * ( y^2*a2 )
 
 + f1(8)
  * ( y^4*a4 )
 
 + f1(10)
  * ( y^5*a5 )
 
 + f1(16)
  * ( y^3*a3 ) + 0.
 
	V p,q
	A AA

	Z xx = pow(y)*f1(a2,a3)*pDq^2

L 2	Id,Count,AA,y,2,f1,-4,p,1,q,3

	*end
 
xx = 
 + f1(a2,a3)
  * ( y*a1*AA^6*pDq^2 + y^2*a2*AA^8*pDq^2 + y^3*a3*AA^10*pDq^2
  + y^4*a4*AA^12*pDq^2 + y^5*a5*AA^14*pDq^2 ) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:49.  Memory: start 0001BCE0, length 476860.


C Example 22.

	A a,b,c,d,e

	Z xxx = F1(e,d,c,b,a) + F2(e,d,c,b,a) +F3(e,d,c,b,a)

L 1	Id,Cyclic,F1,2,5,4
L 2	Id,Symme,F2,F3,2,3,4

	*end
 
xxx = + F1(e,a,c,d,b)
 
 + F2(a,b,c,d,e)
 
 + F3(e,b,c,d,a) + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:51.  Memory: start 0001BCE0, length 476860.


C Example 23.

	V p,q,k,pp,qp,kp

	Z xxx = Epf(k,p,q)*Epf(kp,pp,qp) + Epf(i1,i2,i3,i4)*Epf(i1,i2,j3,j4)

L 1	Id,Epfred

	*end
 
xxx = 
  + pDpp*qDqp*kDkp - pDpp*qDkp*kDqp - pDqp*qDpp*kDkp + pDqp*qDkp*kDpp
   + pDkp*qDpp*kDqp - pDkp*qDqp*kDpp
 
 + 2*D(i3,j3)*D(i4,j4)
 
 - 2*D(i3,j4)*D(i4,j3) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:53.  Memory: start 0001BCE0, length 476860.


C Example 24.

	F f1,f2,f3,f4

	Z xxx = f1(-a1,-a2,a3,-a4) + f2(-a1,-a2,a3,-a4) + f3(-a1,-a2,a3,-a4)
		+ f4(-a1,-a2,a3,-a4)

L 1	Id,Even,f1,2,3,f2
L 2	Id,Odd,f3,2,3,f4

	*end
 
xxx = 
 + f1(-a1,a2,a3,-a4)
 
 + f2(a1,a2,a3,a4)
 
 - f3(-a1,a2,a3,-a4)
 
 - f4(a1,a2,a3,a4) + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:55.  Memory: start 0001BCE0, length 476860.


C Example 25.

	V p,q

	Z xxx = a1^2*pDq^3/p(4)

L 1	Id,Numer,a1,2,pDq,1.E10,p(4),1.E5

	*end
 
xxx =  + .4E+26 + 0.
 

End run. Time 0 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:56.  Memory: start 0001BCE0, length 476860.


C Example 26.

	A a1,a2,a2ma1
	F f1
	B b2,b3,b4,b5

	Z xx=f1(8,4)

L 1	Id,f1(n~,m~)=
		{ b2*a1^n*a2^m 
		+ b3*a1^-n*a2^m 
		+ b4*a1^n*a2^-m
		+ b5*a1^-n*a2^-m
		}

L 3	Id,Ratio,a1,a2,a2ma1
	*begin
 
xx = 
 + b2
  * ( a1^8*a2ma1^4 + 4*a1^9*a2ma1^3 + 6*a1^10*a2ma1^2 + 4*a1^11*a2ma1
   + a1^12 )
 
 + b3
  * ( a1^-8*a2ma1^4 + 4*a1^-7*a2ma1^3 + 6*a1^-6*a2ma1^2 + 4*a1^-5*a2ma1
   + a1^-4 )
 
 + b4
  * ( - 20*a1*a2ma1^3 + 10*a1^2*a2ma1^2 - 4*a1^3*a2ma1 + a1^4
  + a2^-4*a2ma1^8 - 8*a2^-3*a2ma1^7 + 28*a2^-2*a2ma1^6 - 56*a2^-1*a2ma1^5
   + 35*a2ma1^4 )
 
 + b5
  * ( a1^-8*a2ma1^-4 - 4*a1^-7*a2ma1^-5 + 10*a1^-6*a2ma1^-6
  - 20*a1^-5*a2ma1^-7 + 35*a1^-4*a2ma1^-8 - 56*a1^-3*a2ma1^-9
  + 84*a1^-2*a2ma1^-10 - 120*a1^-1*a2ma1^-11 + a2^-4*a2ma1^-8
  + 8*a2^-3*a2ma1^-9 + 36*a2^-2*a2ma1^-10 + 120*a2^-1*a2ma1^-11 ) + 0.
 

Begin. Time 1 sec.

C Here the use of Ratio with [] names.

	B [b-a]

	Z xxx = 1/[x+a]^3 * 1/[x+b]^2

L 1	Id,Ratio,[x+a],[x+b],[b-a]
> P output
	*yep
 
xxx = + [b-a]^-4
  * ( 3*[x+a]^-1 - 3*[x+b]^-1 )
 
 + [b-a]^-3
  * ( - 2*[x+a]^-2 - [x+b]^-2 )
 
 + [b-a]^-2
  * ( [x+a]^-3 ) + 0.
 
C Just checking...

L 1	Id,[x+a]^n~ = (x+a)^(3+n)*(x+b)^2/[x+a]^3/[x+b]^2
L 1	Al,[x+b]^n~ = (x+a)^3*(x+b)^(2+n)/[x+a]^3/[x+b]^2
L 3	Id,b = [b-a] + a
	*end
 
xxx =  + [x+a]^-3*[x+b]^-2 + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:33:59.  Memory: start 0001BCE0, length 476860.


C Example 27. Muon decay.

  Masses and momenta:	muon Mm,k; electron Me,p;
			anti-e-neutrino qp; mu-neutrino q. 
  The length of the 3-dimensional parts of p, q and qp are
  denoted by pl, ql and qpl. The variable z is the cosine
  of the angle between p and q (3-dimensional parts).
  Also k0, p0 etc are the energies of the particles. Note
  that k4=i*k0 etc. Note also that q0=ql, qp0=qpl since
  the neutrino masses are taken to be zero.

C Further quantities: Pi=3.14... and Mpr is the proton mass.

C The evaluation is in the muon rest-system, thus kl=0 and
  k0=Mm.

	A Me,Mm,ql,qpl,pl,p0,Pi,b,z,bp,Mpr,Al
	V p,q,qp,k
	I mu,mup,i1,i2
	F Dia=u

	Z     Rate = Dia(mu,1)*Conjg(Dia(mup,10))/2

C Factor 1/2 for averaging over muon polarizations.

L 2	Id,Dia(mu~,n~) = Ubg(n,Me,p)*G(n,n+1,mu,G6)*Ug(n+1,0,qp)
	             *Ubg(n+2,0,q)*G(n+2,n+3,mu,G6)*Ug(n+3,Mm,k)
L 4	Id,Spin,p,q,k,qp

C There are two separate traces here. They may be unified to
  advantage as they have two indices in common (mu and mup).

L 5	Id,Gammas,"U

C Apply conservation of four-momentum  qp=k-p-q  and
  the mass-shell relations kDk=-Mm^2, pDp=-Me^2 and
  qDq=qpDqp=0.

L13	Id,qpDq=kDq-pDq
L13	Al,qpDk=-Mm^2-pDk-qDk
L13	Al,qpDp=pDk+Me^2-qDp
L14	Id,Funct,qp(mu~) = k(mu) - p(mu) - q(mu)

	*yep

L 1	Id,pDq=pl*ql*z-p0*ql
L 1	Al,pDk=-Mm*p0
L 1	Al,qDk=-ql*Mm
L 1	Al,kDk=-Mm^2
L 1	Al,pDp=-Me^2

C Integration over all angles of the vector p
  gives a factor 4*Pi:

L 2	Id,Addfa,4*Pi

C The integration over the azimuthal angle of q
  gives a factor 2*Pi. Including the various factors
  1/(2k0)..., a factor (2*Pi)^4/{(2*Pi)^3)}^3
  and the factors from going to polar coordinates
  for q and p gives:

L 3	Id,Addfa,2*Pi/16/Mm/p0/ql/qpl*pl^2*ql^2/32/Pi^5

C The remaining delta function is delta(k0-p0-q0-qp0).
  For given p0=Sqrt(pl^2+Me^2) and q0=ql this may be
  solved for z using qp0=qpl=length(p+q)=
  Sqrt(pl^2+ql^2+2*pl*ql*z) where z is the cosine of
  the angle of q with the third axis, taken along p. 
  In this last comment p and q are three-vectors.

C Note that integration over the delta-function gives
  a factor 1/Abs(F), where F is the derivative of the
  argument of the delta function with respect to z.
  This F is equal to ql*pl/qpl.

L 4	Id,z=(0.5*Me^2+0.5*Mm^2-Mm*p0-ql*Mm+ql*p0)/pl/ql
L 4	Al,Addfa,qpl/ql/pl

	*yep

	B Pi

C The next integration is over the length ql. The
  endvalues are denoted by qma and qmi, with
  qma=(Mm-p0+pl)/2 and qmi=(Mm-p0-pl)/2. These
  values obtain for configurations where the electron
  and both neutrinos are aligned. The maximum value
  obtains if the momentum qp is in the direction
  of the electron momentum, while q is pointed in the
  opposite direction. Then pl+qpl=ql and q0=Mm-p0-qp0,
  and one solves ql(=q0)=(Mm-p0+pl)/2.

C Actually, ql^-1 is not occurring here, but for
  completeness we include it in the integration.

L 1	IF NOT ql^-1=[Log(qa/qb)]
	AND NOT ql^n~=qma^(n+1)/(n+1)-qmi^(n+1)/(n+1)
L 1	Al,Addfa,qma-qmi
	ENDIF

L 3	Id,qma=0.5*Mm-0.5*p0+0.5*pl
L 3	Al,qmi=0.5*Mm-0.5*p0-0.5*pl

	*yep

L 1	Id,Multi,p0^2 = pl^2+Me^2
L 2	Id,p0 = (pl^2+Me^2)/p0

C The answer contains essentially one kinematic variable,
  namely pl (or p0). The spectrum that follows from this
  equation is typical for a V-A theory. Using a variable
  x (shown below) this spectrum follows an equation derived
  by Michel provided a parameter ro in that equation, called
  Michel parameter, is set to 3/4.

> P output
	*yep
 
Rate = + Pi^-3
  * ( - Me^2*Mm*pl^2*p0^-1 + 1/2*Me^2*pl^2 - 2/3*Mm*pl^4*p0^-1
  + 1/2*Mm^2*pl^2 ) + 0.
 

C The final integration is over pl. A new variable
  x defined by x=pl+p0, with p0=Sqrt(pl^2+Me^2)
  is used in the following. One has dx/d(pl)=1+p/p0
  and this may be rewritten as d(pl)/p0 = dx/x.
  Note that pl=(x-Me^2/x)/2.
  There are terms with and without p0^-1, and they
  are treated separately.
  The variable plmx is the maximum value of pl, i.e.
  plmx=(Mm-Me^2/Mm)/2. This is achieved if both neutrinos
  are aligned and opposite to the electron. The
  energy of the neutrinos is then simply pl, since
  the sum of the momenta must be equal to the electron
  momentum. In that case therefore Mm=p0+pl, which gives
  the stated value for plmx. Note that Mm is the endpoint
  value for x, corresponding to maximum pl.
  The minimum value for pl is 0, for x it is Me.

L 1	IF p0^-1=1/x
L 1	Al,pl^n~=(x/2-Me^2/x/2)^n
L 3	Id,x^-1=[Log(Mm/Me)]
L 3	Al,x^n~=Mm^(n+1)/(n+1)-Me^(n+1)/(n+1)
	ELSE
L 2	..IF NOT pl^n~=plmx^(n+1)/(n+1)
L 2	..Al,Addfa,plmx
	..ENDIF
	ENDIF

L 5	Id,plmx=Mm/2-Me^2/Mm/2

> P output
	*yep
 
Rate = + Pi^-3
  * ( - 1/12*Me^2*Mm^3 + 1/4*Me^4*Mm*[Log(Mm/Me)] + 1/12*Me^6*Mm^-1
   - 1/96*Me^8*Mm^-3 + 1/96*Mm^5 ) + 0.
 

	Digits 7

C Numerical evaluation. One usually introduces the coupling
  constant g/Sqrt(2)/Mpr^2, and then g is to be taken such
  that the muon lifetime comes out to be 2.197134E-6.
  Note also the factor (h/(2*Pi))^-1 to convert Mev to 1/seconds.

L 1	Id,Addfa,g^2/6.582173E-22/2/Mpr^4
L 2	Id,Numer,Mm,105.65946,Me,0.5110034,[Log(Mm/Me)],5.33160,Mpr,938.2796
L 3	Al,Numer,Pi,3.141592653589793238

C Multiply the Rate (= inverse lifetime) with the experimental
  lifetime. Then g can be solved from the requirement that
  the result must be one. This gives g = 1.024E-5, which
  corresponds to the well-known result for the fermi-coupling
  constant:
	Gf = 1.02 * 10^-5 /Sqrt(2) /Mpr^2 .

L 4	Id,Addfa,2.197134E-6

> P output
	*yep
 
Rate =  + .9525066D+10*g^2 + 0.
 

L 1	Id,g = 1.0246275E-5

	*end
 
Rate =  + .1D+1 + 0.
 

End run. Time 1 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:34:01.  Memory: start 0001BCE0, length 476860.


C Example 28.

C The problem is to make a series expansion of a
  complicated expression in terms of quantities a and b.
  The expression was given in terms of the quantities
  called X1,X2,Omx1a,X2b,Bmx2a,Fac1 and Fac2 here below.

C The problem was solved in two separate runs. Here the
  first run is shown. The object is to give the series
  expansion for the quantities mentioned. Up to order 7
  in a and/or b is required. The quantity ep is an expansion
  parameter, essentially counting the order in a and b.
  Terms ep^8 and higher are to be ignored, the sooner the
  better. For this the assignment ep=8 in the A-list is
  the best tool.

C The calculation proceeds by building up one quantity
  after the next, step by step.

	Common X1,X2,Omx1a,X2b,Bmx2a,Fac1,Fac2

	A ep=8,a,b
	X X(a)=ep^2*(a^2+b^2-2*a*b)-2*ep*(a+b)

	*fix

Begin. Time 1 sec.

C First certain roots called WO and WOI are needed.
  These are of the form Sqrt(1+XX) and 1/Sqrt(1+XX).
  The quantity XX itself is a function of a and b,
  given above as X(a). In the following DO-loop the
  powers of X(a) are computed:
  XX(1)=X(a), XX(2)=X(a)^2 etc.

	Z XX(0)=1.

	Keep XX
	*next
 
XX(0) =  + 1 + 0.
 

	DO K1=1,7
	B ep
	Z XX(1)=X(a)*XX(1-1)
	Nprint XX(1)
	Keep XX
	*next
	ENDDO

C Now the roots WO and WOI can be computed. The expansions
  used here are simply the expansions for Sqrt(1+x) and
  1/Sqrt(1+x).

	B ep

	Z WO = 1 + XX(1)/2 - XX(2)/8 + XX(3)/16 - 5*XX(4)/128
		+ 7*XX(5)/256 - 21*XX(6)/1024 + 33/2048*XX(7)
	Z WOI = 1 - XX(1)/2 + 3*XX(2)/8 - 5*XX(3)/16 + 35*XX(4)/128
		- 63*XX(5)/256 + 231*XX(6)/1024 - 429/2048*XX(7)

	Keep WO,WOI
	*next
 
WO = 
  + 1
 
 + ep
  * ( - a - b )
 
 + ep^2
  * ( - 2*a*b )
 
 + ep^3
  * ( - 2*a*b^2 - 2*a^2*b )
 
 + ep^4
  * ( - 2*a*b^3 - 6*a^2*b^2 - 2*a^3*b )
 
 + ep^5
  * ( - 2*a*b^4 - 12*a^2*b^3 - 12*a^3*b^2 - 2*a^4*b )
 
 + ep^6
  * ( - 2*a*b^5 - 20*a^2*b^4 - 40*a^3*b^3 - 20*a^4*b^2 - 2*a^5*b )
 
 + ep^7
  * ( - 2*a*b^6 - 30*a^2*b^5 - 100*a^3*b^4 - 100*a^4*b^3 - 30*a^5*b^2
   - 2*a^6*b )
 
WOI = 
  + 1
 
 + ep
  * ( a + b )
 
 + ep^2
  * ( 4*a*b + a^2 + b^2 )
 
 + ep^3
  * ( 9*a*b^2 + 9*a^2*b + a^3 + b^3 )
 
 + ep^4
  * ( 16*a*b^3 + 36*a^2*b^2 + 16*a^3*b + a^4 + b^4 )
 
 + ep^5
  * ( 25*a*b^4 + 100*a^2*b^3 + 100*a^3*b^2 + 25*a^4*b + a^5
  + b^5 )
 
 + ep^6
  * ( 36*a*b^5 + 225*a^2*b^4 + 400*a^3*b^3 + 225*a^4*b^2 + 36*a^5*b
   + a^6 + b^6 )
 
 + ep^7
  * ( 49*a*b^6 + 441*a^2*b^5 + 1225*a^3*b^4 + 1225*a^4*b^3
  + 441*a^5*b^2 + 49*a^6*b + a^7 + b^7 ) + 0.
 

	B ep

	Z X1=0.5+0.5*b*ep-0.5*a*ep+0.5*WO
	Z X2=0.5+0.5*b*ep-0.5*a*ep-0.5*WO

	Keep WOI
	*next
 
X1 = 
  + 1
 
 + ep
  * ( - a )
 
 + ep^2
  * ( - a*b )
 
 + ep^3
  * ( - a*b^2 - a^2*b )
 
 + ep^4
  * ( - a*b^3 - 3*a^2*b^2 - a^3*b )
 
 + ep^5
  * ( - a*b^4 - 6*a^2*b^3 - 6*a^3*b^2 - a^4*b )
 
 + ep^6
  * ( - a*b^5 - 10*a^2*b^4 - 20*a^3*b^3 - 10*a^4*b^2 - a^5*b )
 
 + ep^7
  * ( - a*b^6 - 15*a^2*b^5 - 50*a^3*b^4 - 50*a^4*b^3 - 15*a^5*b^2
  - a^6*b )
 
X2 = 
 + ep
  * ( b )
 
 + ep^2
  * ( a*b )
 
 + ep^3
  * ( a*b^2 + a^2*b )
 
 + ep^4
  * ( a*b^3 + 3*a^2*b^2 + a^3*b )
 
 + ep^5
  * ( a*b^4 + 6*a^2*b^3 + 6*a^3*b^2 + a^4*b )
 
 + ep^6
  * ( a*b^5 + 10*a^2*b^4 + 20*a^3*b^3 + 10*a^4*b^2 + a^5*b )
 
 + ep^7
  * ( a*b^6 + 15*a^2*b^5 + 50*a^3*b^4 + 50*a^4*b^3 + 15*a^5*b^2
  + a^6*b ) + 0.
 

	B ep

	Z Omx1a=1/a/ep-X1/a/ep
	Z X2b=X2/b/ep
	Z Bmx2a=b/a-X2/a/ep

	Keep WOI
	*next
 
Omx1a = 
  + 1
 
 + ep
  * ( b )
 
 + ep^2
  * ( a*b + b^2 )
 
 + ep^3
  * ( 3*a*b^2 + a^2*b + b^3 )
 
 + ep^4
  * ( 6*a*b^3 + 6*a^2*b^2 + a^3*b + b^4 )
 
 + ep^5
  * ( 10*a*b^4 + 20*a^2*b^3 + 10*a^3*b^2 + a^4*b + b^5 )
 
 + ep^6
  * ( 15*a*b^5 + 50*a^2*b^4 + 50*a^3*b^3 + 15*a^4*b^2 + a^5*b
  + b^6 )
 
X2b = 
  + 1
 
 + ep
  * ( a )
 
 + ep^2
  * ( a*b + a^2 )
 
 + ep^3
  * ( a*b^2 + 3*a^2*b + a^3 )
 
 + ep^4
  * ( a*b^3 + 6*a^2*b^2 + 6*a^3*b + a^4 )
 
 + ep^5
  * ( a*b^4 + 10*a^2*b^3 + 20*a^3*b^2 + 10*a^4*b + a^5 )
 
 + ep^6
  * ( a*b^5 + 15*a^2*b^4 + 50*a^3*b^3 + 50*a^4*b^2 + 15*a^5*b
  + a^6 )
 
Bmx2a = 
 + ep
  * ( - b )
 
 + ep^2
  * ( - a*b - b^2 )
 
 + ep^3
  * ( - 3*a*b^2 - a^2*b - b^3 )
 
 + ep^4
  * ( - 6*a*b^3 - 6*a^2*b^2 - a^3*b - b^4 )
 
 + ep^5
  * ( - 10*a*b^4 - 20*a^2*b^3 - 10*a^3*b^2 - a^4*b - b^5 )
 
 + ep^6
  * ( - 15*a*b^5 - 50*a^2*b^4 - 50*a^3*b^3 - 15*a^4*b^2 - a^5*b
  - b^6 ) + 0.
 

	B ep
	A ep=7

C For Fac1 and Fac2 only up to ep^6 is needed.

	Z Fac1=(b*ep-X1)*WOI
	Z Fac2=(X2-b*ep)*WOI

	*begin
 
Fac1 = 
  - 1
 
 + ep^2
  * ( - a*b )
 
 + ep^3
  * ( - 2*a*b^2 - 2*a^2*b )
 
 + ep^4
  * ( - 3*a*b^3 - 9*a^2*b^2 - 3*a^3*b )
 
 + ep^5
  * ( - 4*a*b^4 - 24*a^2*b^3 - 24*a^3*b^2 - 4*a^4*b )
 
 + ep^6
  * ( - 5*a*b^5 - 50*a^2*b^4 - 100*a^3*b^3 - 50*a^4*b^2 - 5*a^5*b )
 
Fac2 = 
 + ep^2
  * ( a*b )
 
 + ep^3
  * ( 2*a*b^2 + 2*a^2*b )
 
 + ep^4
  * ( 3*a*b^3 + 9*a^2*b^2 + 3*a^3*b )
 
 + ep^5
  * ( 4*a*b^4 + 24*a^2*b^3 + 24*a^3*b^2 + 4*a^4*b )
 
 + ep^6
  * ( 5*a*b^5 + 50*a^2*b^4 + 100*a^3*b^3 + 50*a^4*b^2 + 5*a^5*b ) + 0.
 

Begin. Time 3 sec.

C Wrinting of common files. The printed list shows which
  common files were in existence here; a common file
  has =C after its name. The X-expression X uses two
  levels and has =X2 after its name. It is not written.

> P lists
	Write expP
	*end


A i=i, ep=7, a, b

F D, Epf=i, G=i, Gi, G5=i, G6=c, G7, Ug=c, Ubg, DD, DB, DT, DS, DX, 
  DK, DP, DF=u, DC

E X1=C, X2=C, Omx1a=C, X2b=C, Bmx2a=C, Fac1=C, Fac2=C, X=X2

End run. Time 3 sec.
Schoonschip, 68000 version of June 27, 1991. Public version.
Date: Sun Dec 12 1993 18:34:06.  Memory: start 0001BCE0, length 476860.


C Example 29.

C In this second part (Example 28 is first part)
  we will not show the whole calculation of all
  expressions as they were needed, but just
  the evaluation of the first one, which is
  enough to clarify the procedure. First the
  output of example 27 must be entered.

	Enter expP
	A ep=7,a,b
	*fix

Begin. Time 0 sec.

	B ep

	Z Arg(1) = X2
	Z Arg(3) = (b-a)*X2/b
	Z Arg(4) = 1 - X2b
	Z Arg(5) = Omx1a*X2b - 1
	Z Arg(6) = (b-a)*(1-X1)/a
	Z Arg(7) = (a-b)*ep*Omx1a
	Z Arg(8) = Bmx2a

	Keep Arg
	*next
 
Arg(1) = 
 + ep
  * ( b )
 
 + ep^2
  * ( a*b )
 
 + ep^3
  * ( a*b^2 + a^2*b )
 
 + ep^4
  * ( a*b^3 + 3*a^2*b^2 + a^3*b )
 
 + ep^5
  * ( a*b^4 + 6*a^2*b^3 + 6*a^3*b^2 + a^4*b )
 
 + ep^6
  * ( a*b^5 + 10*a^2*b^4 + 20*a^3*b^3 + 10*a^4*b^2 + a^5*b )
 
Arg(3) = 
 + ep
  * ( - a + b )
 
 + ep^2
  * ( a*b - a^2 )
 
 + ep^3
  * ( a*b^2 - a^3 )
 
 + ep^4
  * ( a*b^3 + 2*a^2*b^2 - 2*a^3*b - a^4 )
 
 + ep^5
  * ( a*b^4 + 5*a^2*b^3 - 5*a^4*b - a^5 )
 
 + ep^6
  * ( a*b^5 + 9*a^2*b^4 + 10*a^3*b^3 - 10*a^4*b^2 - 9*a^5*b
  - a^6 )
 
Arg(4) = 
 + ep
  * ( - a )
 
 + ep^2
  * ( - a*b - a^2 )
 
 + ep^3
  * ( - a*b^2 - 3*a^2*b - a^3 )
 
 + ep^4
  * ( - a*b^3 - 6*a^2*b^2 - 6*a^3*b - a^4 )
 
 + ep^5
  * ( - a*b^4 - 10*a^2*b^3 - 20*a^3*b^2 - 10*a^4*b - a^5 )
 
 + ep^6
  * ( - a*b^5 - 15*a^2*b^4 - 50*a^3*b^3 - 50*a^4*b^2 - 15*a^5*b
  - a^6 )
 
Arg(5) = 
 + ep
  * ( a + b )
 
 + ep^2
  * ( 3*a*b + a^2 + b^2 )
 
 + ep^3
  * ( 6*a*b^2 + 6*a^2*b + a^3 + b^3 )
 
 + ep^4
  * ( 10*a*b^3 + 20*a^2*b^2 + 10*a^3*b + a^4 + b^4 )
 
 + ep^5
  * ( 15*a*b^4 + 50*a^2*b^3 + 50*a^3*b^2 + 15*a^4*b + a^5
  + b^5 )
 
 + ep^6
  * ( 21*a*b^5 + 105*a^2*b^4 + 175*a^3*b^3 + 105*a^4*b^2 + 21*a^5*b
   + a^6 + b^6 )
 
Arg(6) = 
 + ep
  * ( - a + b )
 
 + ep^2
  * ( - a*b + b^2 )
 
 + ep^3
  * ( - a^2*b + b^3 )
 
 + ep^4
  * ( 2*a*b^3 - 2*a^2*b^2 - a^3*b + b^4 )
 
 + ep^5
  * ( 5*a*b^4 - 5*a^3*b^2 - a^4*b + b^5 )
 
 + ep^6
  * ( 9*a*b^5 + 10*a^2*b^4 - 10*a^3*b^3 - 9*a^4*b^2 - a^5*b
  + b^6 )
 
Arg(7) = 
 + ep
  * ( a - b )
 
 + ep^2
  * ( a*b - b^2 )
 
 + ep^3
  * ( a^2*b - b^3 )
 
 + ep^4
  * ( - 2*a*b^3 + 2*a^2*b^2 + a^3*b - b^4 )
 
 + ep^5
  * ( - 5*a*b^4 + 5*a^3*b^2 + a^4*b - b^5 )
 
 + ep^6
  * ( - 9*a*b^5 - 10*a^2*b^4 + 10*a^3*b^3 + 9*a^4*b^2 + a^5*b
  - b^6 )
 
Arg(8) = 
 + ep
  * ( - b )
 
 + ep^2
  * ( - a*b - b^2 )
 
 + ep^3
  * ( - 3*a*b^2 - a^2*b - b^3 )
 
 + ep^4
  * ( - 6*a*b^3 - 6*a^2*b^2 - a^3*b - b^4 )
 
 + ep^5
  * ( - 10*a*b^4 - 20*a^2*b^3 - 10*a^3*b^2 - a^4*b - b^5 )
 
 + ep^6
  * ( - 15*a*b^5 - 50*a^2*b^4 - 50*a^3*b^3 - 15*a^4*b^2 - a^5*b
  - b^6 ) + 0.
 

	B ep

C The Sp are certain functions of a variable x.
  Sp(1) = Log(1-x)/x, higher Sp are obtained by
  iteration, involving differentiation.
  In the end x must be set to (a-b)/a.
  The XX2 are powers of -Arg(1).

	Z Sp(1) = - Lomx/x
	Z XX2(1) = - Arg(1)

	Nprint Sp,XX2
	Keep Sp,XX2,Arg
	*next

	B ep

	DO K1=2,6
	Z Sp(2) = Difx*Sp(2-1)/2
	Z XX2(2) = - XX2(2-1)*Arg(1)

L 5	Id,Difx*Lomx = - 1/Omx + Lomx*Difx
L 6	Id,Difx*Omx^n~ = - n*Omx^(n-1) + Omx^n*Difx
L 8	Id,Difx*x^n~ = n*x^(n-1) + x^n*Difx
L10	Id,Difx = 0

C Note that only negative exponents of x occur here.
L11	Id,x^n~*Omx^-1 = DS(J1,1,-n,(x^-J1)) + 1/Omx

	Nprint Sp,XX2
	Keep Sp,XX2,Arg
	*next
	ENDDO

	B Lga,Lgb

	DO K2=1,6
	Z Sp(1) = Sp(1)*x^1
	ENDDO

C Omx = 1-x appears only with negative exponent. It
  is rewritten in terms of x/(1-x) = Xomx, which
  is possible here since the exponent of x is here
  always larger than minus the exponent of Omx.

L 2	Id,x^n~*Omx^m~ = Xomx^-m*x^(n+m)
L 4	Id,x = (a-b)/a
L 4	Al,Xomx = (a-b)/b
L 6	Id,Lomx = Lgb - Lga

	Nprint Sp
	Keep Sp,XX2,Arg
	*next

C Now finally the first of the desired expressions
  is worked out.

	B ep,Lga,Lgb

	Z Exp(1) = DS(J3,1,6,{Sp(J3)*XX2(J3)})

	*end
 
Exp(1) = 
 + ep*Lga
  * ( - b )
 
 + ep*Lgb
  * ( b )
 
 + ep^2
  * ( 1/2*a*b - 1/2*b^2 )
 
 + ep^2*Lga
  * ( - a*b - 1/2*b^2 )
 
 + ep^2*Lgb
  * ( a*b + 1/2*b^2 )
 
 + ep^3
  * ( - 1/3*a*b^2 + 5/6*a^2*b - 1/2*b^3 )
 
 + ep^3*Lga
  * ( - 2*a*b^2 - a^2*b - 1/3*b^3 )
 
 + ep^3*Lgb
  * ( 2*a*b^2 + a^2*b + 1/3*b^3 )
 
 + ep^4
  * ( - 7/4*a*b^3 + 9/8*a^2*b^2 + 13/12*a^3*b - 11/24*b^4 )
 
 + ep^4*Lga
  * ( - 3*a*b^3 - 9/2*a^2*b^2 - a^3*b - 1/4*b^4 )
 
 + ep^4*Lgb
  * ( 3*a*b^3 + 9/2*a^2*b^2 + a^3*b + 1/4*b^4 )
 
 + ep^5
  * ( - 53/15*a*b^4 - 8/5*a^2*b^3 + 64/15*a^3*b^2 + 77/60*a^4*b
  - 5/12*b^5 )
 
 + ep^5*Lga
  * ( - 4*a*b^4 - 12*a^2*b^3 - 8*a^3*b^2 - a^4*b - 1/5*b^5 )
 
 + ep^5*Lgb
  * ( 4*a*b^4 + 12*a^2*b^3 + 8*a^3*b^2 + a^4*b + 1/5*b^5 )
 
 + ep^6
  * ( - 67/12*a*b^5 - 125/12*a^2*b^4 + 50/9*a^3*b^3 + 75/8*a^4*b^2
   + 29/20*a^5*b - 137/360*b^6 )
 
 + ep^6*Lga
  * ( - 5*a*b^5 - 25*a^2*b^4 - 100/3*a^3*b^3 - 25/2*a^4*b^2
  - a^5*b - 1/6*b^6 )
 
 + ep^6*Lgb
  * ( 5*a*b^5 + 25*a^2*b^4 + 100/3*a^3*b^3 + 25/2*a^4*b^2
  + a^5*b + 1/6*b^6 ) + 0.
 

End run. Time 3 sec.
