-
Notifications
You must be signed in to change notification settings - Fork 8
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
factor function #81
Comments
I think both |
That was my guess. Hope it will be implemented one day, this would be very helpful. Thank you for your answer |
In RxODE, we did factoring by symengine -> expand -> dsl parsing. It is possible, but it would be done outside of symengine. |
@mattfidler, is this univariate polynomial factoring? |
It is multivariate polynomial factoring. However, in principle it is the same as univariate polynomial factoring applied to each term in a polynomial or non-polynomial expression. I used it for inductive linearization. |
Yeah, a generic factoring would be able to factor, |
Not for my purposes. You are right, of course. |
@mattfidler , thank you for your suggestion. I have never used RxODE so I will have a look. Do you have a piece of code to illustrate the procedure? |
Hm. It is buried in the package (and it is off-topic for this repository) First after using symengine's I can then use that same function to split with the This is used in the mutiple item factoring found here: https://github.com/nlmixrdevelopment/RxODE/blob/pruneBranch/R/rxIndLin.R#L27-L129 |
library(RxODE);
lapply(rxSplitPlusQ("a*exp(b+c)+d*log(e-f)-g*f"),function(x){eval(parse(text=sprintf("rxSplitPlusQ(quote(%s),mult=TRUE)",x)))})
#> [[1]]
#> [1] "a" "exp(b + c)"
#>
#> [[2]]
#> [1] "d" "log(e - f)"
#>
#> [[3]]
#> [1] "-g" "f" Created on 2020-01-27 by the reprex package (v0.3.0) |
Thank you very much! |
Hello,
Is there an equivalent of the factor function provided by in sympy package (i.e. the opposition of the expand function? https://www.geeksforgeeks.org/python-sympy-factor-method/ ? If not, is there plan to implement it? I guess this depends on the availability in the symengine engine? Anyway, thank you for your brilliant package.
Hilaire
The text was updated successfully, but these errors were encountered: