Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get the (numeric) coefficent of a specified symbol in an expression #171

Open
whu-dft opened this issue Aug 5, 2019 · 0 comments
Open

Comments

@whu-dft
Copy link

whu-dft commented Aug 5, 2019

Is there a funcion to get the coefficent of a specified symbol in an expression, for example

julia> using SymEngine

julia> x, y = symbols("x y")
(x, y)

julia> y = (2*x+1)^3
(1 + 2*x)^3

julia> y_expand = expand(y)
1 + 6*x + 12*x^2 + 8*x^3

If we want to get the coefficent of x^2, than we have a function
get_coefficent(x^2, y) or get_coefficent(x^2, y_expand) . Then the function return 12.

I think this is a basis function. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant