Skip to content

Fixed function exponentiation not being parsed correctly#266

Open
MadScientistBR wants to merge 1 commit into
lambda-feedback:mainfrom
MadScientistBR:fix/func_exp
Open

Fixed function exponentiation not being parsed correctly#266
MadScientistBR wants to merge 1 commit into
lambda-feedback:mainfrom
MadScientistBR:fix/func_exp

Conversation

@MadScientistBR

Copy link
Copy Markdown

Problem

sec2(x)** and sec^2(x) were treated as invalid. Therefore, the users had to manually write sec(x)^2 to get sec^2(x).

Turns out this was a SymPy parser configuration issue: the function_exponentiation transformation, which rewrites f**n(x) as f(x)**n, isn't enabled by default and has to be explicitly included.

Changes

  • app/utility/expression_utilities.py: We explicitly pass the function_exponentitation transformation to the SymPy parser in function parse_expression (line 813 and 815).
  • app/tests/symbolic_evaluation_test.py: added test cases covering all supported trig/hyperbolic functions.

Closes issue #257.

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

Successfully merging this pull request may close these issues.

1 participant