TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Solving 100 Bushels Using Matrix Factorization

33 pointsby jmount8 months ago

5 comments

satisfice8 months ago
The brute force method proposed in the article is so strangely obscure.<p>Here&#x27;s a very simple alternative:<p><pre><code> for m in range(0,100): for w in range(0,100): for c in range (0,100): if m + w + c == 100 and 3*m+2*w+.5\*c==100: print(m,w,c)</code></pre>
评论 #41718573 未加载
评论 #41717917 未加载
评论 #41718767 未加载
cjlarose8 months ago
Does this technique apply if the dimension of the null space of the linear transformation is greater than 1? In other words, if there is more than 1 free variable, can you still use the Smith normal form of the matrix to find a bijection from the integers to the solution set?<p>Edit: related follow up: any chance this technique is a good fit for enumeration of [Magic Squares][0] of a given order?<p>[0]: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Magic_square" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Magic_square</a>
CamperBob28 months ago
Interestingly, o1-preview gets all 7 solutions in 18 seconds. It also makes short work of Bachet’s Four Weights Problem as recounted at <a href="https:&#x2F;&#x2F;ninazumel.com&#x2F;blog&#x2F;2024-09-29-four-weights&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ninazumel.com&#x2F;blog&#x2F;2024-09-29-four-weights&#x2F;</a> .<p>Pretty smart parrot.
评论 #41732468 未加载
qsort8 months ago
Am I stupid or this is solvable with pen and paper?<p>The word problem directly translates to this system of diophantine equations:<p><pre><code> (i) { x + y + z = 100 (ii) { 6x + 4y + z = 200 </code></pre> Replacing z in (ii) using (i) yields:<p><pre><code> (ii) &lt;=&gt; 6x + 4y - x - y + 100 = 200 &lt;=&gt; 5x + 3y = 100 </code></pre> Which is solvable with the usual method.
评论 #41718231 未加载
评论 #41725604 未加载
ggrothendieck8 months ago
In R `nnls` (nonnegative least squares) does not guarantee integrality but in this case does give one solution and it happens to be integral: `library(nnls); nnls(A, b)`