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

solving returns VecBasic of length 0 #93

Open
levibaguley opened this issue May 15, 2020 · 2 comments
Open

solving returns VecBasic of length 0 #93

levibaguley opened this issue May 15, 2020 · 2 comments

Comments

@levibaguley
Copy link

levibaguley commented May 15, 2020

I would've put this one on StackOverflow but this package seems pretty new so I thought asking you guys would be the best.
I'm trying to solve a function that looks something like this:

P == 1 / (1 + exp(-(b0 + b1 * r + b2 * t)))

It's a logistic function but I want it in terms of r. This is my attempt.

library(symengine)
#> SymEngine Version: 0.4.1
#>  _____           _____         _         
#> |   __|_ _ _____|   __|___ ___|_|___ ___ 
#> |__   | | |     |   __|   | . | |   | -_|
#> |_____|_  |_|_|_|_____|_|_|_  |_|_|_|___|
#>       |___|               |___|

use_vars(b0, b1, b2, P, t, r)
#> Initializing 'b0', 'b1', 'b2', 'P', 't', 'r'
exp <- 1L / (1L + exp(-(b0 + b1 * r + b2 * t))) - P
exp
#> (Add)    -P + (1 + exp(-(b0 + r*b1 + t*b2)))^(-1)
solve(exp, r)
#> VecBasic of length 0
#> V(  )

Is symengine unable to solve this? It isn't clear what VecBasic of length 0 means. When do you think non-polynomials will be able to be solved in this package?

R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

@Marlin-Na
Copy link
Member

Thanks for reporting. Yes currently only polynomials can be solved with this package and it's a bug that it should raise an error instead of returning an empty VecBasic.

There is ongoing effort to integrate SymPy with the package so it could provide a generic solver (hopefully be available soon). But that would require additional setup.

By the way, are you using symengine on Windows?

@levibaguley
Copy link
Author

Yes, see edits.

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

2 participants