I want to change a SymPy expression, for example x+y
( x=symbols("x")
and the same thing for y
), into a polynomial, and then get the generators of this polynomial and the length of this polynomial.
I've tried
op=x+y
op = op[:as_poly](domain="C")
op_a = op.x[:gens]
nab = op[:length]()
but it seems that it doesn't work .
The error that i'm getting is this:
ERROR: MethodError: no method matching getindex(::Sym, ::Symbol)
Closest candidates are:
getindex(::Sym, ::Sym...) at /Users/midow/.julia/packages/SymPy/1Cwgd/src/utils.jl:18
getindex(::Number) at number.jl:75
getindex(::Number, ::Integer) at number.jl:77
...
Stacktrace:
[1] top-level scope at REPL[11]:1