Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -0,0 +1,44 @@
|
|||
proc abs(int n) int: if n<0 then -n else n fi corp
|
||||
|
||||
proc write_term(word index; int scalar; bool first) void:
|
||||
if first then
|
||||
if scalar<0 then write("-") fi
|
||||
else
|
||||
write(if scalar<0 then " - " else " + " fi)
|
||||
fi;
|
||||
if abs(scalar)>1 then
|
||||
write(abs(scalar), '*')
|
||||
fi;
|
||||
write("e(",index,")")
|
||||
corp
|
||||
|
||||
proc lincomb([*]int terms) void:
|
||||
bool first;
|
||||
word index;
|
||||
first := true;
|
||||
|
||||
for index from 0 upto dim(terms,1)-1 do
|
||||
if terms[index] /= 0 then
|
||||
write_term(index+1, terms[index], first);
|
||||
first := false
|
||||
fi
|
||||
od;
|
||||
|
||||
writeln(if first then "0" else "" fi)
|
||||
corp
|
||||
|
||||
proc main() void:
|
||||
[3]int a1 = (1,2,3);
|
||||
[4]int a2 = (0,1,2,3);
|
||||
[4]int a3 = (1,0,3,4);
|
||||
[3]int a4 = (1,2,0);
|
||||
[3]int a5 = (0,0,0);
|
||||
[1]int a6 = (0);
|
||||
[3]int a7 = (1,1,1);
|
||||
[3]int a8 = (-1,-1,-1);
|
||||
[4]int a9 = (-1,-2,0,3);
|
||||
[1]int a10 = (-1);
|
||||
lincomb(a1); lincomb(a2); lincomb(a3); lincomb(a4);
|
||||
lincomb(a5); lincomb(a6); lincomb(a7); lincomb(a8);
|
||||
lincomb(a9); lincomb(a10)
|
||||
corp
|
||||
Loading…
Add table
Add a link
Reference in a new issue