% File:	DEMO.INT  (c)		10/07/81	The Soft Warehouse %

ECHO: FALSE $
NEWLINE: 1 $
DENNUM: -30$
A: 'A$
B: 'B$
POINT: FALSE$
NUMNUM: LOGEXPD: 30$
DENDEN: 2$
PWREXPD: 6$
TRGEXPD: -15$
MOVD ('NEWLINE, 'CRLF)$ 
FUNCTION NEWLINE (EX1, EX2),
  CRLF (EX1),
  BLOCK
    WHEN INTEGER (PAUSE) EXIT,
    PAUSE: 10
  ENDBLOCK,
  EX2: PAUSE,
  LOOP
    WHEN NOT POSITIVE (EX2) EXIT,
    1000*1000,
    EX2: EX2-1
  ENDLOOP
ENDFUN$

ECHO: TRUE$
%
Use CTRL-S to start and stop the
scrolling of this demostration file.

The length of the momentary pause
between problems is controlled by the
size of the variable PAUSE.  The
default value of PAUSE is 10.

This demo requires the following
muMATH files be loaded:
	EQN.ALG		LOG.ALG
	TRGNEG.ALG      DIF.ALG
	INT.DIF
%

%***  INTEGER ARITHMETIC EXAMPLES  ***%

% INTEGER ADDITION & SUBTRACTION %

32 + 15 - 24;% MULTIPLICATION & UNARY MINUS %

5 * -12;% USE OF PARENTHESIS % 

436 * (123 - 57);% RAISING TO A POWER %

100^3;% ASSIGNMENTS TO A VARIABLE %

FOO: (3*8 - 16)^2;% USE OF ASSIGNED VARIABLE % 

3*FOO^5;% SAVE INTERMEDIATE RESULTS %

SEC#PER#YR: 365*24*3600;IN#PER#MI: 5280*12;% USE OF INTERMEDIATE RESULTS %
% TO FIND INCHES TO ALHPA CENTAURI %

4 * 186000 * SEC#PER#YR * IN#PER#MI;% EXACT, INFINITE PRECISION % 

99^99;
%*** RATIONAL ARITHMETIC EXAMPLES  ***%

% REDUCE FRACTIONS TO LOWEST TERMS %

56/77;% FIND COMMON DENOMINATOR % 

5/6 - 3/4;% RATIONAL SIMPLIFICATION % 

3 * (1/2 + 1/6);% FLOATING POINT NOTATION %

POINT: 10$1/3;
%***      VARIABLE RADIX BASE      ***%

% SET FOR HEXADECIMAL ARITHMETIC %

RADIX (16);% USE AS A HEX CALCULATOR %

7C80 - 2*12EF + 0A3C;% ASSIGNMENT TO A VARIABLE %

EG: 10000;% RETURN TO BASE TEN ARITHMETIC %

RADIX (0A);% FIND EG IN BASE TEN %

EG;% BASE TWO ARITHMETIC %

RADIX (2);% BINARY ARITHMETIC CALCULATOR %

101101110 * EG;% RETURN TO BASE TEN ARITHMETIC %

RADIX (1010);
%***  EXPONENTIAL SIMPLIFICATIONS  ***%

% FRACTIONAL POWERS %
8 ^ (2/3);12 ^ (1/2);% POWERS OF THE IMAGINARY NUMBER %

#I^2;#I^-7;% COMPLEX EXPONENTIALS % 

#E ^ (#I*#PI);
%***           FACTORIALS          ***%

5!;50!^2;% BINOMIAL COEFFICIENTS [12:30] % 

N: 30;M: 12;N! / ((N-M)!*M!);  
%***    BASIC ALGEBRA EXAMPLES     ***%

% AUTOMATIC ALGEBRAIC SIMPLIFICATION %

% COMBINES SIMILAR TERMS AND FACTORS %

3*X - X;Y^3 * Y^(R+1);
% EXPLOITS IDENTITIES AND ZEROS %

0 + X;1 * Y;Z * 0;X^1;Y^0;1^X;% MULTIPLE SIMPLIFICATIONS %

5*X^1*Y + Y^2*-3*X/Y + W^(Z^2 - Z*Z);% POLYNOMIAL MULTIPLICATION % 

(3*X - 2*Y) * (Y^2 + 4*X);% POLYNOMIAL POWERS %

(X+1)^2;(X+5) * (X^2-2*X+3)^2;% CONTENT FACTORIZATION % 

FCTR (6*X^3*Y + 15*X^2*Y);  
%***  LOGARITHMIC SIMPLIFICATIONS  ***%

% NATURAL LOG OF ONE %

LN (1);% COMMON LOG OF 1000 %

LOG (1000, 10);% EXPAND THE LOG OF A PRODUCT %

LN (X*Y);% EXPAND THE LOG OF A POWER %

LOG (Z^3, 10);% MULTIPLE SIMPLIFICATIONS % 

LN(X^2*Y) - 2*LN(X);% INTER-BASE SIMPLIFICATIONS %

LOG(X,10) * LOG(10,#E);% LOGARITHMIC POWERS %

#E ^ LN(X+5);
%*** TRIGONOMETRIC SIMPLIFICATIONS ***%

% ELEMENTARY ANGLE VALUES %

COS (0);SIN (#PI/2);SIN (37*#PI/3);% EQUIVALENT FUNCTIONS %

TAN(X) * COS(X);% MULTIPLE ANGLES EXPANSION %

SIN (2*X);COS(3*X);% ANGLE SUMS EXPANSION %

COS (X-Y);% COMBINATION EXPANSIONS %

EG: SIN (2*X+Y);
%***      REPRESENT EQUATIONS      ***%

EQN: 2*X+7 == A^2 - X^2/X - 3;% STEP BY STEP SOLUTION FOR X %

EQN: EQN + X - 7;EQN: EQN/3;
%***      CALCULUS OPERATIONS      ***%

% FIND DERIVATIVES %

DIF (3*X^2 + 5*X - 4, X);DIF (LN(X)^2, X);DIF (#E^X^2, X);DIF (P*SIN(X) + X^2, X);% FIND INTEGRALS %

INT (2*X - 1/X, X);INT (X * #E^X^2 * SIN(#E^X^2), X);INT (LN(LN(X))/X, X);
%***     PROGRAMMING IN MUSIMP     ***%

% TAYLOR SERIES EXPANSION FUNCTION %

FUNCTION TAYLOR (EXPN, X, A, N,	
% Locals: % J, C, ANS, NUMNUM, DENNUM),
  NUMNUM: DENNUM: 30,
  J: ANS: 0,
  C: 1,
  LOOP
    ANS: ANS + C * EVSUB (EXPN, X, A),
    WHEN J=N, ANS EXIT,
    EXPN: DIF (EXPN, X),
    J: J + 1,
    C: C * (X-A) / J,
  ENDLOOP,
ENDFUN ;% TAYLOR SERIES EXPANSION %

TAYLOR (#E^X, X, 0, 6);TAYLOR (SIN(X), X, 0, 8);TAYLOR (#E^SIN(X), X, 0, 4);
MOVD ('CRLF, 'NEWLINE)$ RDS ()$
