2

I am trying to use coeffs function in Julia 1.7.1 but getting the error below:

i get error while using [p0].coeffs().keys()

the error occurs in the below code in the last line where i have S = [p0].coeffs().keys() see the code below:

p0 = sympify(dense_interpolation([a[1]] .+ r, [p0] .+ P).subs(Symbol('x'), x_var[1]))
print("[p0] = ")
println([p0])
print("p0 = ")
println(p0)
S = [p0].coeffs().keys()

the type of the p0 is Sym and the value inside it is 1 as you can see on the first picture. can anyone help me out on this.

7
  • deleted......... Commented Jan 21, 2022 at 22:56
  • 1
    Why are you doing [p0].coeffs()? I think you just want p0.coeffs(). Commented Jan 21, 2022 at 23:02
  • 1
    @SilvioMayolo this is using Julia's PyCall bindings to interface with SymPy. It does relate to Python. Commented Jan 21, 2022 at 23:03
  • 1
    @AshrafYawar can you please replace the images of code with text? And structure the code such that others can replicate your issue? Commented Jan 21, 2022 at 23:05
  • 1
    Please provide stackoverflow.com/help/minimal-reproducible-example . What is a what is r etc. It is quite hard to help with a piece of code cut out from the context. Commented Jan 22, 2022 at 12:16

1 Answer 1

1

There is an issue with the latest doc build, but search for coeffs here https://docs.juliahub.com/SymPy/KzewI/1.1.1/introduction/

One thing, [p].coeffs is very unlikely to work, as this doesn’t call the method of p, rather a container you created with [].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.