-
Notifications
You must be signed in to change notification settings - Fork 270
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
[WIP]Add apart algorithm for polynomials #1617
base: master
Are you sure you want to change the base?
Conversation
Hi, I've run clang-format and found that the code needs formatting. To use the commit you can do
|
I created this PR because I have a questions regarding it. Please bear me. Can anyone tell me how exactly I can test my code, i am certainly able to test it but i want to know all procedure to test after editing the code so that i should not miss anything. And can anybody tell me how I should search some already built function just like i found is_A_Atom here. |
@isuruf can you please please advice me here that how should I frame this class and I went through the expand.cpp also. |
Should it also be based on visitor design pattern? |
@jmig5776 thanks for trying to write a prototype. As a prototype, you can use any design pattern you want, the goal is to get something little working. Then we'll work on designing it well. To get something little working, try to write a function that accepts a SymEngine expression, converts it to a univariate polynomial (there is code to do that in SymEngine already) and then extracts the coefficients and prints them on the screen. Once you have that, please ping me, and we'll go from there. (The next step would be to try to write apart() for that simple case.) |
Okay I am on it. |
ping @certik |
@certik I think we might need cancel function here to extract the common parts and then rationalise and make them Add and then multiplying with the common from cancel. What do you think? What should be the next step according to you? |
Good progress, now you have the Here are the next steps:
And that's pretty much it. Then it just needs to be assembled back into |
You can also try to implement it from here directly, to get something working: https://en.wikipedia.org/wiki/Partial_fraction_decomposition#Procedure You also need So I would start with So let's start by writing a |
In fact SymEngine already implements
|
Here is how to do division using Flint: symengine/symengine/polys/uintpoly_flint.h Line 214 in d0b1932
So try to use these operations (division and factors) to implement the apart using the algorithm at https://en.wikipedia.org/wiki/Partial_fraction_decomposition#Procedure. I think you just construct a linear matrix using the factors, and solve it (SymEngine can do that) to determine the coefficients, and you are set. |
Okay I am on it . Soon will be sending a PR. |
Thanks for trying to figure it out. |
@certik there is no need to thanks. As a open sourcer I want to contribute to make it fastest but truthfully earlier i didn't know development in c++ so in previous two weeks I learnt all the syntaxes and wrote proposal and read about grobner basis. So I might be slow now but will take up the pace in one or two weeks |
This PR tends to add apart algorithm corresponding to polynomials just like as we have in sympy but with better benchmarks.
More information will be added soon.
Please suggest ideas or guidance for it.
CC @certik @isuruf