It's also generally better to give the terms and add them all at once:

```
pattern = [-Wild('b', exclude=var)]
for i, v in enumerate(var):
    pattern.append(Wild("a" + str(i+1), exclude=var) * v)
return eq.match(Add(*pattern)), var, diop_type
```

But why are you using pattern matching? Don't you just want the coefficient from each term in which case you can do

```
return dict([reversed(t.as_independent(*var)) for t in eq.args]), diop_type
```

You don't need to pass the variables because those are the keys (and the constant is keyed to "1").