1 | initial version |
The solve
function has an optional argument solution_dict
.
Using it, solutions are returned as dictionaries, which makes it easier to access the solved values of each unknown.
Here is a way to use that in the function from the question.
def polynomial_coefficient(fcn1, fcn2): a, b = SR.var('a, b') eqn1 = 2a + 2b == 0 eqn2 = 3a - b == 1 sol = solve([eqn1, eqn2], a, b, solution_dict=True)[0] return sol[a]fcn1 + sol[b]*fcn2
2 | No.2 Revision |
The solve
function has an optional argument solution_dict
.
Using it, solutions are returned as dictionaries, which makes it easier to access the solved values of each unknown.
Here is a way to use that in the function from the question.
def polynomial_coefficient(fcn1, fcn2):
a, b = SR.var('a, b')
eqn1 =