@@ -59,7 +59,7 @@ def cross_derivative(expr, dims, fd_order, deriv_order, x0=None, side=None, **kw
5959 Semantically, this is equivalent to
6060
6161 >>> (f*g).dxdy
62- Derivative(Derivative( f(x, y)*g(x, y), x) , y)
62+ Derivative(f(x, y)*g(x, y), x, y)
6363
6464 The only difference is that in the latter case derivatives remain unevaluated.
6565 The expanded form is obtained via ``evaluate``
@@ -158,15 +158,15 @@ def make_derivative(expr, dim, fd_order, deriv_order, side, matvec, x0, coeffici
158158 # `coefficients` method (`taylor` or `symbolic`)
159159 if weights is None :
160160 weights = fd_weights_registry [coefficients ](expr , deriv_order , indices , x0 )
161- elif wdim is not None :
161+ # Did fd_weights_registry return a new Function/Expression instead of a values?
162+ _ , wdim , _ = process_weights (weights , expr , dim )
163+ if wdim is not None :
162164 weights = [weights ._subs (wdim , i ) for i in range (len (indices ))]
163165
164166 # Enforce fixed precision FD coefficients to avoid variations in results
165167 if scale :
166168 scale = dim .spacing ** (- deriv_order )
167- else :
168- scale = 1
169- weights = [sympify (scale * w ).evalf (_PRECISION ) for w in weights ]
169+ weights = [sympify (scale * w ).evalf (_PRECISION ) for w in weights ]
170170
171171 # Transpose the FD, if necessary
172172 if matvec == transpose :
0 commit comments