-
-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Description
I came across a strange issue when computing derivatives of linear terms. Consider the following MWE:
@variables x
@derivatives Dx'~x
@parameters a, b
a₀ = 1; b₀ = -2;
If I define an expression with unspecified parameters (a,b)
, everything works as expected:
julia> H = a * x + b * log(x)
(a * x) + (b * log(x))
julia> expand_derivatives(Dx(H))
a + (b * inv(x))
But when I define the same expression with fixed parameters (a₀,b₀)
, the derivatives are missing some terms:
julia> H₀ = a₀ * x + b₀ * log(x)
(1 * x) + (-2 * log(x))
julia> expand_derivatives(Dx(H₀))
-2 * inv(x)
Funnily, if I have an expression with only the linear terms, everything is fine as well:
julia> K₀ = a₀ * x
1 * x
julia> expand_derivatives(Dx(K₀))
1
I am on the latest #master as of this morning.
Edit: Simplified MWE.
Metadata
Metadata
Assignees
Labels
No labels