Skip to content

Avoid variables in power #171

Answered by MilesCranmer
python-ista asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @python-ista!

(-1, 1) means that the left argument (in pow, this is the base) can have arbitrarily large complexity, while the 1 signifies that the right argument can only have complexity of at most 1. By default, all operators, variables, and constants have a complexity of 1. The total complexity of an expression is computed but summing the individual complexities.

One thing you could try is to set complexity_of_variables=2 which, along with constraints={"pow": (-1, 1)}, would prevent variables appearing in the exponent while still allowing constants.

Cheers,
Miles

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@python-ista
Comment options

Answer selected by python-ista
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
PySR PySR-related discussion
2 participants