Is f assumed to be a function of all coords?
Just of the top of my head
I suppose something like this can be done.
>>> coords = symbols("x,y,z")
>>> derivatives = [diff(f, coor) for coor in coords]
So that you get a list of your derivatives.
Or I might have been completely wrong in understandi
Maybe you want to use nested lambdas:
map(lambda c: lambda f: Diff(f,c), coords)
On Wednesday, April 17, 2013 10:11:14 PM UTC+2, brombo wrote:
>
> Consider the following
>
> coords = symbols('x,y,z')
>
> I wish to contruct the list of functions:
>
> [Dx,Dy,Dx]
>
> where
>
> def Dx(f):
>
You can do the whole thing symbolically with Lambda
[Lambda(f, Derivative(f, coord)) for coord in coordinates]
Unlike the normal list comprehension, Derivative is unevaluated, so
you create the object before you actually have f, and unlike the
lambda version, you can access and manipulate the obj
Thanks for the answer (and for the question too). I had been thinking of a
way to implement methods that would be independent of number of
coordinates. I just ran some test code and this method works great. I think
I can use this for the proposed vector calculus module. Also, I suppose we
can u