Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

LLL Play Files

Views: 198

prices = [2.15, 2.75, 3.35, 3.55, 4.20, 5.80] target = 15.05
I = identity_matrix(3)
print "Hello"
Hello
%md # This is HTML

This is HTML

I.determinant()
1
C = 10^5 #big constant d = len(prices)+1 I = identity_matrix(d) X = Matrix(ZZ,d,1) X[0,0] = -floor(target*C) for i in range(1,d): X[i,0] = floor(C*prices[i-1]) M = I.augment(X) print M
[ 1 0 0 0 0 0 0 -1505000] [ 0 1 0 0 0 0 0 215000] [ 0 0 1 0 0 0 0 275000] [ 0 0 0 1 0 0 0 335000] [ 0 0 0 0 1 0 0 355000] [ 0 0 0 0 0 1 0 420000] [ 0 0 0 0 0 0 1 580000]
M.commutator?
File: /projects/sage/sage-6.9/src/sage/matrix/matrix0.pyx Signature : M.commutator() Docstring : Return the commutator self*other - other*self. EXAMPLES: sage: A = Matrix(ZZ, 2, 2, range(4)) sage: B = Matrix(ZZ, 2, 2, [0, 1, 0, 0]) sage: A.commutator(B) [-2 -3] [ 0 2] sage: A.commutator(B) == -B.commutator(A) True
M.LLL()
[ 0 1 -2 1 0 0 0 0] [ 1 1 0 0 2 0 1 0] [ 0 1 0 1 -2 -1 1 0] [ 1 -1 1 2 1 1 0 0] [ 1 -2 0 0 1 1 2 0] [ 0 2 0 -1 -1 2 -1 0] [ 0 0 -1 1 1 -1 0 -5000]

In this case an acceptable answer will have 1 in the first column and positive integers in the all but the last column. So I would put an order in for Mixed Fruit, 2 orders of Hot Wings, and a Sampler Plate.