Thanks for your answers, finally I do something like :
nb, exclus = 0, []
k, n, A,B = Wild('k',exclude = [0]), Wild('n',exclude =
set([0,1])),Wild('A', exclude = exclus), Wild('B')
T = (A+k*x**n+B).matches(AvantS)
while T != None and nb < 100 :
# Traitement
if diff(ApresS,var)==
diff(T[A],var)+(T[k]*S('x')**T[n])+diff(T[A],var) :
print 'A2:'+str(T[k])+":"+str(T[n])
# Recherche du suivant
exclus.append(T[A])
A = Wild('A', exclude = exclus)
T = (A+k*x**n+B).matches(AvantS)
nb = nb + 1
And it works for me
Vincent
Le mardi 11 février 2014 22:40:27 UTC+1, Vincent MAILLE a écrit :
>
> Hi, is it possible to find all possible matches :
>
> exp = S('3*x**2+2*x**3')
> k, n, A,B = Wild('k',exclude = [0]), Wild('n',exclude =
> set([0,1])),Wild('A'), Wild('B')
> T = (A+k*x**n+B).matches(exp)
>
> returns
>
> {k_: 2, n_: 3, A_: 0, B_: 3*x**2}
>
> But can I have :
> [{k_: 2, n_: 3, A_: 0, B_: 3*x**2}, {k_: 3, n_: 2, A_: 2*x**3, B_: 0}]
>
> Thanks
>
> Vincent
>
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.