Question
Question (Python) The Frobenius equation is the Diophantine equation, a_1 x_1 +... + a_n x_n = b where a_i> 0 are positive integers, b> 0
Question
(Python)
The Frobenius equation is the Diophantine equation,
a_1 x_1 +... + a_n x_n = b
where a_i> 0 are positive integers, b> 0 is a positive integer, and the solution x_i consists of non-negative integers. Here is a sample run,
>>> solvefrob([1,2,3,5],10) [(0, 0, 0, 2), (0, 1, 1, 1), (0, 2, 2, 0), (0, 5, 0, 0), (1, 0, 3, 0), (1, 2, 0, 1), (1, 3, 1, 0), (2, 0, 1, 1), (2, 1, 2, 0), (2, 4, 0, 0), (3, 1, 0, 1), (3, 2, 1, 0), (4, 0, 2, 0), (4, 3, 0, 0), (5, 0, 0, 1), (5, 1, 1, 0), (6, 2, 0, 0), (7, 0, 1, 0), (8, 1, 0, 0), (10, 0, 0, 0)]
Hint: Use Numpy broadcasting effectively. There is a timeout in the test-case, so if it takes too long to compute (e.g, you used too many for loops), it will be marked wrong. The function signature is solvefrob(coefs,b) where coefs is the list of a_i coefficients. You can only use Numpy for this problem. No other third party packages.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started