Non-Newtonian calculus
The usual way is to specify both the expression and the relevant variables.
Clear[stard]
stard[expr_, x_] := Module[{h, result},
result = Limit[((expr /. x -> (x + h))/expr)^(1/h), h -> 0];
result /; Head[result] =!= Limit]
stard[x^2, x]
(* Exp[2/x] *)
This is what builtin functions do too, e.g. Integrate[expr, x]
or FourierTransform[expr, t, ω]
.
Update: Here's a version which can do multiple steps in one evaluation. The most complex part of this is the error checking. The order of definitions is crucial.
Clear[stard]
stard[expr_, {x_, 0}] := expr
stard[expr_, {x_, 1}] := stard[expr, x]
stard[expr_, {x_, n_Integer?Positive}] :=
Module[{part},
part = stard[expr, {x, n - 1}];
stard[part, x] /; Head[part] =!= stard
]
stard[expr_, Except[_List, x_]] :=
Module[{h, result},
result = Limit[((expr /. x -> (x + h))/expr)^(1/h), h -> 0];
result /; Head[result] =!= Limit
]
Example:
stard[Sin[x], {x, 3}]
(* E^(2 Cot[x] Csc[x]^2) *)
This is a product derivative. Using the solution from here,
ProductD[f_, x_] := ProductD[f, {x, 1}];
ProductD[f_, {x_, k_Integer?NonNegative}] := Exp[D[Log[f], {x, k}]]
ProductD[Sin[x], {x, 3}]
(* E^(2 Cot[x] Csc[x]^2) *)