SymEngine.jl
SymEngine.jl copied to clipboard
coeff not producing correct output
When I run coeff without expand I get
julia> coeff.((1 + h)*x_2*(h^2*t^2*Umax + 2*h*t*(1 + h)*x_2),t,0:3)
4-element Array{Basic,1}:
0
0
0
0
but when I run expand first I get the correct result
julia> coeff.(expand((1 + h)*x_2*(h^2*t^2*Umax + 2*h*t*(1 + h)*x_2)),t,0:3)
4-element Array{Basic,1}:
0
2*h*x_2^2 + 4*h^2*x_2^2 + 2*h^3*x_2^2
h^2*x_2*Umax + h^3*x_2*Umax
0
@isuruf The issue also extends to problems where the 0th order coefficient is an Int, Float, or Rational. Here is a very basic example
julia> coeff.(-1//2*Basic(1)+t,t,0:3)
4-element Array{Basic,1}:
0
1
0
0
julia> coeff.(-1//2*Basic(1),t,0:3)
4-element Array{Basic,1}:
-1/2
0
0
0
I think I fixed this in https://github.com/symengine/symengine/commit/c853166c1e5cada03a07112c5fca89de991ba14b
is the current Julia build v0.7.0 using that version of Symengine?