You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kai and I have had an off-line discussion along the following lines. I want to publish my thinking before submitting code changes.
The main branch insists on binarizing unary operators. We do this by prefixing cos(x), say, by +,-,*,/. If we want balance among the four arithmetic primitives, then all four variations must appear in the operators_XXX.csv file.
This seems to me unnecessary. Two changes are required in fx_eval_label():
1. Treat unary operators as left prefixes. Emit op+'('+arg+')'. Walk this node pre-order.
2. Parenthesize the arguments of (infix) binary operators. Emit '('+arg1+')+op+'('+arg2+')'. Walk this node in-order.
There are knock-on effects elsewhere in the code. These arise from the assumption that all operators are binary. I have found most (all?) of them. Fixing them permits unary minus also to work as expected.
The ternary case (if/then/else) eludes me. I know of no equivalent syntax that sympy.sympify will accept. I propose replacing this code with an easily interpretable error message.
The text was updated successfully, but these errors were encountered:
rll2021
added a commit
to rll2021/karoo_gp
that referenced
this issue
Feb 9, 2021
Kai and I have had an off-line discussion along the following lines. I want to publish my thinking before submitting code changes.
The main branch insists on binarizing unary operators. We do this by prefixing cos(x), say, by +,-,*,/. If we want balance among the four arithmetic primitives, then all four variations must appear in the operators_XXX.csv file.
This seems to me unnecessary. Two changes are required in fx_eval_label():
1. Treat unary operators as left prefixes. Emit op+'('+arg+')'. Walk this node pre-order.
2. Parenthesize the arguments of (infix) binary operators. Emit '('+arg1+')+op+'('+arg2+')'. Walk this node in-order.
There are knock-on effects elsewhere in the code. These arise from the assumption that all operators are binary. I have found most (all?) of them. Fixing them permits unary minus also to work as expected.
The ternary case (if/then/else) eludes me. I know of no equivalent syntax that sympy.sympify will accept. I propose replacing this code with an easily interpretable error message.
The text was updated successfully, but these errors were encountered: