Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
def linearCombo:
|
||||
reduce to_entries[] as {key: $k,value: $v} ("";
|
||||
if $v == 0 then .
|
||||
else
|
||||
(if $v < 0 and length==0 then "-"
|
||||
elif $v < 0 then " - "
|
||||
elif $v > 0 and length==0 then ""
|
||||
else " + "
|
||||
end) as $sign
|
||||
| ($v|fabs) as $av
|
||||
| (if ($av == 1) then "" else "\($av)*" end) as $coeff
|
||||
| . + "\($sign)\($coeff)e\($k)"
|
||||
end)
|
||||
| if length==0 then "0" else . end ;
|
||||
|
||||
# The exercise
|
||||
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
|
||||
|
||||
[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]
|
||||
| "\(lpad(15)) => \(linearCombo)"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[1,2,3] => e0 + 2*e1 + 3*e2
|
||||
[0,1,2,3] => e1 + 2*e2 + 3*e3
|
||||
[1,0,3,4] => e0 + 3*e2 + 4*e3
|
||||
[1,2,0] => e0 + 2*e1
|
||||
[0,0,0] => 0
|
||||
[0] => 0
|
||||
[1,1,1] => e0 + e1 + e2
|
||||
[-1,-1,-1] => -e0 - e1 - e2
|
||||
[-1,-2,0,-3] => -e0 - 2*e1 - 3*e3
|
||||
[-1] => -e0
|
||||
Loading…
Add table
Add a link
Reference in a new issue