In the code you last posted, you do a substitution of new_var with vi and 
then differentiate wrt new_var. This will necessarily give you 0, won't it? 
 Is this what you are trying to do:

>>> def vdiff(x, vector):
...     ans = []
...     for vi in vector:
...         if vi.is_Symbol:
...             tmp = []
...             for e in x:
...                 tmp.append(e.diff(vi))
...         else:
...             subs = {}
...             new_var = Dummy()
...             for s in vi.free_symbols:
...                 subs[s] = solve(new_var - vi, s)[0]
...             tmp = []
...             for e in x:
...                 e = e.subs(subs, simultaneous=True)
...                 d = Dummy('ei')
...                 e = idiff(d-e, d, new_var)
...                 e = e.subs({new_var: vi})
...                 tmp.append(e)
...         ans.append(tmp)
...     return ans
...
>>> vdiff([x, x+y], [x, x-c])
[[1, 1], [1, 1]]
>>> vdiff([x, x+y], [x, exp(x)-c])
[[1, 1], [exp(-x), exp(-x)]]
>>> vdiff([x, x+y], [x, exp(x)-y])
[[1, 1], [exp(-x), (-exp(x) + 1)*exp(-x)]]

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to