Algebra.mesa
Last Edited by: Arnon, June 20, 1985 4:46:23 pm PDT
A cad database written on the Vax is parsed and written as a read-only Tioga document. Another (probably typescript) viewer is created as a main work area. Other viewers will be created as needed by operations. Available operations are:
+, -, * of polynomials
Int, Union, Diff of formulas.
Simplify formula (arbitary formula?)
Eval formula at point.
Plot cell, plot cluster, plot arbitrary collection of cells.
Plot formula (do cdsas, plot the cells).
Fork projection, cad, qe computation to Vax.
Browse adjacency graph: follow adjacency chain.
Coordinate change (to explore Prill adjacency algorithm)
The general mode of operations is for commands to take the contents of the current selection as their argument, which they then parse. Lists of multiple arguments are built up in a separate viewer, then selected. Command output goes to the main work area viewer.
Variable lists are extracted from arguments, where necessary, commands specify a variable and variable list reordering of arguments is done.
Vax Steps: QFFWRL (linear write qff), New kind of df's (y is the ith root of F(x,y))?, routine to do qerd and write Cedar-readable database (clustering cad records all info it has about sample points; option to crawl either .savcl file or Cedar-readable database and construct all sample points) (either recompute projections with verbosity, or change projection operator to record verbosity as it works).
Parser: read distributed polynomial according to specified variable list, convert to recursive form, read qff, handle arithmetic of polynomials, extract variable list on the fly, quantified formulas not in prenex form.
Display distributed polynomials with exponents raised with Tioga superscript look.
Cedar requirements: Rootisolater (to move plotting over). Polynomial evaluation at algebraic point.
Cedar issues: Integration of autded.tex and cad databases (TeX, Preview, Whiteboards). What cad algorithm do we want to implement (impact of Prill?).
DIRECTORY
Commander,
Process,
RatNums,
ViewerClasses,
Rope,
Menus,
IO,
ViewerIO,
ViewerTools,
ViewerOps,
TypeScript,
Polynomials;
Algebra: CEDAR MONITOR
IMPORTS Menus, ViewerIO, ViewerTools, TypeScript, Polynomials =
BEGIN OPEN Polynomials;
windowCount: INT ← 0; -- a count of the number of calculators created
MakeCalculator: ENTRY Commander.CommandProc = BEGIN
Puts up a calculator window.
title: Rope.ROPE;
windowCount ← windowCount+1;
title ← IO.PutFR["Algebra machine number %g", IO.int[windowCount]];
TRUSTED {Process.Detach[FORK Calculate[title]];}
END;
Calculate: PROC[title: Rope.ROPE] = {
ts: TypeScript.TS; -- the primary typescript
in, out: IO.STREAM; -- global variables for log writing
poly1, poly2: Polynomials.Polynomial;
dpoly: Polynomials.DPolynomial;
globalV: VariableList;
SetVarList: Menus.MenuProc = {
globalV ← VariableListFromRope[ViewerTools.GetSelectionContents[] ];
WriteVariableList[globalV, out];
};
SetDPoly: Menus.MenuProc = {
dpoly ← DPolynomialFromRope[ViewerTools.GetSelectionContents[], globalV];
WriteDPolynomial[dpoly, globalV, out];
};
SetPoly1: Menus.MenuProc = {
poly1 ← PolynomialFromRope[ViewerTools.GetSelectionContents[], globalV];
WriteDPolynomial[DPolyFromPoly[poly1, globalV], globalV, out];
};
SetPoly2: Menus.MenuProc = {
poly2 ← PolynomialFromRope[ViewerTools.GetSelectionContents[], globalV];
WriteDPolynomial[DPolyFromPoly[poly2, globalV], globalV, out];
};
AddPolys: Menus.MenuProc = {
poly1 ← PolynomialAdd[poly1, poly2];
WriteDPolynomial[DPolyFromPoly[poly1, globalV], globalV, out];
};
NegatePoly: Menus.MenuProc = {
poly1 ← PolynomialNegate[poly1];
WriteDPolynomial[DPolyFromPoly[poly1, globalV], globalV, out];
};
SubtractPolys: Menus.MenuProc = {
poly1 ← PolynomialSubtract[poly1, poly2];
WriteDPolynomial[DPolyFromPoly[poly1, globalV], globalV, out];
};
MultiplyPolys: Menus.MenuProc = {
poly1 ← PolynomialMultiply[poly1, poly2];
WriteDPolynomial[DPolyFromPoly[poly1, globalV], globalV, out];
};
ts ← TypeScript.Create[info: [name: "Algebra"] ];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"VarList", proc: SetVarList]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"DPoly", proc: SetDPoly]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Poly1", proc: SetPoly1]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Poly2", proc: SetPoly2]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Add ", proc: AddPolys]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Negate ", proc: NegatePoly]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Subtract ", proc: SubtractPolys]];
Menus.AppendMenuEntry[menu: ts.menu, entry:Menus.CreateEntry [name:"Multiply ", proc: MultiplyPolys]];
[in: in, out: out] ← ViewerIO.CreateViewerStreams[name: "Algebra",viewer: ts];
DO
out.PutChar[in.GetChar[] ];
ENDLOOP;
};
Commander.Register[
key: "Algebra", proc: MakeCalculator, doc: "Simple algebra system"];
END.