37 lines
867 B
Text
37 lines
867 B
Text
func LinearCombo(Combo, Len); \Display linear combination of Combo
|
|
int Combo, Len;
|
|
int Zero, N, I;
|
|
[Zero:= true;
|
|
for I:= 0 to Len-1 do
|
|
[N:= Combo(I);
|
|
if N # 0 then
|
|
[ if N < 0 and Zero then Text(0, "-")
|
|
else if N < 0 then Text(0, " - ")
|
|
else if not Zero then Text(0, " + ");
|
|
if abs(N) # 1 then
|
|
[IntOut(0, abs(N)); Text(0, "*")];
|
|
Text(0, "e("); IntOut(0, I+1); Text(0, ")");
|
|
Zero:= false;
|
|
];
|
|
];
|
|
if Zero then Text(0, "0");
|
|
CrLf(0);
|
|
];
|
|
|
|
int Combos, C;
|
|
[Combos:= [
|
|
[1, 2, 3],
|
|
[0, 1, 2, 3],
|
|
[1, 0, 3, 4],
|
|
[1, 2, 0],
|
|
[0, 0, 0],
|
|
[0],
|
|
[1, 1, 1],
|
|
[-1, -1, -1],
|
|
[-1, -2, 0, -3],
|
|
[-1],
|
|
[0] \sentinel provides length of last item (=1)
|
|
];
|
|
for C:= 0 to 10-1 do
|
|
LinearCombo( Combos(C), (Combos(C+1)-Combos(C))/4 ); \4 = SizeOfInt
|
|
]
|