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

OP_POW not defined #536

Closed
oameye opened this issue May 31, 2023 · 5 comments
Closed

OP_POW not defined #536

oameye opened this issue May 31, 2023 · 5 comments

Comments

@oameye
Copy link

oameye commented May 31, 2023

Running some code through HarmonicBalance.jl I bump into the error UndefVarError: OP_POW not defined with stacktrace:

  [1] split_into_num_denom!(...)
    @ HomotopyContinuation.ModelKit HomotopyContinuation\src\model_kit\intermediate_representation.jl:391
  [2] process_mul!(...)
    @ HomotopyContinuation.ModelKit HomotopyContinuation\src\model_kit\intermediate_representation.jl:436
  [3] expr_to_ir_statements!(...)
    @ HomotopyContinuation.ModelKit HomotopyContinuation\src\model_kit\intermediate_representation.jl:479
  [4] expr_to_ir_statements!(...)
    @ HomotopyContinuation.ModelKit HomotopyContinuation\src\model_kit\intermediate_representation.jl:465

Indeed, investigating the source code in the model_kit module the definition of OP_POW is commented out. Is there a reason for that? Should OP_POW_INT be used instead at model_kit\intermediate_representation.jl:391?

@saschatimme
Copy link
Member

The code path is only hit if the exponent is not an integer, so OP_POW_INT is most likely wrong. What type of exponents do you have?

When implementing the procedure, I wanted to deal with general exponents initially but I abandoned this approach since it would only be allowed in very specific circumstances. However, I think just supporting rational numbers or floating point values should be easily feasible.

@oameye
Copy link
Author

oameye commented May 31, 2023

Many thanks for responding so quickly. I have managed to make a minimum working example:

using HomotopyContinuation

@var x
@var a b

vars = HomotopyContinuation.Variable[x]
para = HomotopyContinuation.Variable[a, b]

pol = x*sqrt((a^2 - b^2))
eq = Expression[pol]

sys = System(eq, variables = vars, parameters = para)

solve(sys, start_system=:total_degree, target_parameters=Number[0.99, 0.98])

To problem seems to be the sqrt((a^2 - b^2)) in the expression, i.e., we have an exponent of 1/2.

@saschatimme
Copy link
Member

Ah yes the square root is the problem, but this is actually exactly the case that I wanted to support in the first place. I will try to take a look soon :)

@oameye
Copy link
Author

oameye commented Jun 8, 2023

I have tested out the new PR and it solves my original problem I experienced in HarmonicBalance.jl. Thank you!

@saschatimme
Copy link
Member

Happy to hear that :) Just tagged a new release (2.8.3) that contains the fix

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