@variables p, α, N
D = Differential(α)
D((p^α + 1 - p)^N) / log(p) |> expand_derivatives |> x -> substitute(x, α => 1) |> simplify
N*p*(1^(N - 1)).
I was wondering if a substitution rule should be implemented such that
1^x -> 1 no matter what
x is. BTW, Mathematica does it automatically.
f[ α_, p_, N_] := (p^α_ + 1 - p)^N
D[f[a, p, N], a]/(Log[p]) /. a -> 1 # returns N * p
It might be a good idea. Other simplifications area already done by default (you can check them here).
I’ll add a PR for this.
1 is still a reasonable result. (math people think of it as an indeterminate form, but that tends to be less useful than defining it to equal
Open an issue. Note that Symbolics is a typed symbolic system, so
@variables p is
@variables p::Real which is the “standard” type and can make these tricks. I forget the name, but it’s like
@variables p::SafeReal has different rule sets, for example omitting
a/a == 1, which is safe for the case of
a=0. The default is what users generally want, but the safe mode gives people a way to opt in to a slightly slower system that will work for all edge cases, giving the best of both worlds.
Issue #437 on SymbolicsUtils.