-
Notifications
You must be signed in to change notification settings - Fork 216
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
Let sympy use log2(x) instead of log(x)/log(2) #712
base: master
Are you sure you want to change the base?
Conversation
… log(x)/log(base)
codegen looks like an internal utility? https://docs.sympy.org/latest/modules/utilities/codegen.html Is there anything simpler we can use? |
Pull Request Test Coverage Report for Build 10703019687Details
💛 - Coveralls |
I'm not familiar with sympy, so I'm not sure. The docs indicate that the regular
Grepping the sympy source code for instances of log2 did not reveal anything of note, though I may have missed it. |
I am a bit worried about using this version over just |
Good point. I asked over at sympy, and it seems it's a rare but supported function. It is documented at https://docs.sympy.org/latest/modules/codegen.html#sympy.codegen.cfunctions.log2 . |
Thanks! Okay I’m on board then. Now, one other thing is we need the codegen import:
This seems to have been done by some other package, but ideally we should also run this within PySR. |
I think this refers only to the callable, i.e. the function |
Just checking in on this – could you add the line
to the imports? This is needed according to the docs page. |
Can you check if that's correct? My understanding of the docs page is that it refers to the codegen callable, not the codegen namespace. The code only uses the namespace, so the import should not be not required. |
Fixes #711
The case of log10 is also included.
I was not immediately able to run the unit tests, but I tested it with this code:
Equation:
y = (10.003 / log10(x₀)) + log2(x₀ * x₀)
Translated to sympy:
log2(x0*x0) + 10.003168/log10(x0)