# Enumerating solutions to a system of linear relations

Hi, I'm new to sagemath, and I've been away from math courses for a while now. Please be patient with me! :)

I want to feed sagemath a system of linear relations. I'd like sagemath to give back all positive integer solutions to the system. I'll use a classic math exercise to illustrate.

You have pennies, nickels, and dimes. Find all combinations of coins that sum to at least 10 cents, but no more than 15 cents. Select between 5 and 7 coins (inclusive). Only nickels and dimes contribute to the wanted sum. Assume you have more than 7 of each type of coin.

In the relations below, 'pennies', 'nickels', and 'dimes' represent the number of coins from the respective denomination. So, the relations are:

```
pennies + nickels + dimes >= 5
pennies + nickels + dimes <= 7
5*nickels + 10*dimes >= 10
5*nickels + 10*dimes <= 15
```

I'd like sagemath to process the above system into a list of solutions similar to:

```
[
{ pennies: 4, nickels: 0, dimes: 1 },
{ pennies: 5, nickels: 0, dimes: 1 },
{ pennies: 6, nickels: 0, dimes: 1 },
{ pennies: 3, nickels: 1, dimes: 1 },
...
{ pennies: 4, nickels: 3, dimes: 0 }
]
```

This is what I've tried:

```
sage: pennies,nickels,dimes = var('pennies,nickels,dimes')
sage: coins_max = (pennies+nickels+dimes<=7)
sage: coins_min = (pennies+nickels+dimes>=5)
sage: value_max = (5*nickels+10*dimes<=15)
sage: value_min = (5*nickels+10*dimes>=10)
sage: assume( pennies>=0, pennies<=7, nickels>=0, nickels<=7, dimes>=0, dimes<=7 )
sage: coin_solve = solve( [coins_max, coins_min, value_max, value_min], pennies, nickels, dimes, solution_dict=True )
sage: print coin_solve
[
{-2*pennies + 8: nickels, dimes: -1/2*nickels + 1, nickels: -2*pennies + 12},
{-2*pennies + 7: nickels, dimes: -1/2*nickels + 3/2, nickels: -2*pennies + 11},
{-2*pennies + 7: nickels, dimes: -nickels - pennies + 5, nickels: -2*pennies + 8},
{-2*pennies + 11: nickels, dimes: -nickels - pennies + 7, nickels: -2*pennies + 12},
{-2*pennies + 7: nickels, max(-1/2*nickels + 1, -nickels - pennies + 5): dimes, dimes: min(-1/2*nickels + 3/2, -nickels - pennies + 7), nickels: -2*pennies + 12},
{pennies: dimes + 3, nickels: -2*dimes + 2},
{pennies: dimes + 5, nickels: -2*dimes + 2},
{pennies: dimes + 2, nickels: -2*dimes + 3},
{pennies: dimes + 4, nickels: -2*dimes + 3}
]
```

I don't know if solve() is the right approach. Do I need another function to further process solve()'s results? Do I need to write my own?

I'm hoping someone can point me in the right direction. Thank you for your time.