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 = 2*a + 2*b == 0
eqn2 = 3*a - 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 =
```~~2~~*a **2*a + *~~2~~b 2*b == 0
eqn2 = ~~3~~*a **3*a - b == 1
sol = solve([eqn1, eqn2], a, b, solution_dict=True)[0]
return *~~sol[a]~~fcn1 sol[a]*fcn1 + ~~sol[b]*fcn2~~sol[b]*fcn2

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.