Mathematica Asked by Teo7 on December 5, 2020
I’m trying to use this function in mathematica 11:
differentiableAtQ[
f_, p_?VectorQ, vars_?VectorQ, dom_ : Reals
] := With[{n = Length[vars], dimP = Length[p]},
If[n < 1 || n != dimP, Return[]];
If[n > 1,
With[{pd = D[f, #] & /@ vars},
With[{pdValues = ((Evaluate[vars] [Function] #) @@ p) & /@ pd},
(* All partial derivatives exist *)
AllTrue[pdValues, NumericQ] &&
With[{$f = Evaluate[vars] [Function] Evaluate[f]},
(* All partial derivatives are continuous *)
AllTrue[{pd, pdValues}[Transpose],
Apply[Limit[#1, vars -> p] === #2 &]
] || Switch[ (* Taking limit *)
Limit[FullSimplify[
(If[MemberQ[#, _Piecewise, [Infinity]],
# // PiecewiseExpand, #] &)[
(* Edit for correction (n-1) *)
($f @@ vars + (n - 1) $f @@ p
- Total[
$f @@@ (ConstantArray[vars, n]
+ DiagonalMatrix[p - vars])
])/Norm[vars - p]],
And @@ Thread[vars != p]
&& vars [Element] dom],
vars -> p],
0, True,
Indeterminate, False,
_DirectedInfinity, False,
_, Indeterminate
]
]]],
D[f, vars] /. vars[[1]] -> p[[1]] // NumericQ
]]
copied from this question How to write a custom function to judge whether a bivariate function is differentiable at a certain point?
Maybe in mathematica 12 it works fine, but in 11 if I test it with some examples taken from the same post, it say:
General : {x,y} is not a valid variable .
So, how can I adapt this function to make it usable in mathematica 11?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP