Closed crowlogic closed 3 months ago
arb.exceptions.UndefinedReferenceException: Undefined reference to variable 'z' in expression=2*x², expression.rootNode=2*(x^2), independent variable is x and parentExpression is null
at arb4j/arb.expressions.nodes.Variable.resolveInheritedVariableReference(Variable.java:463)
at arb4j/arb.expressions.nodes.Variable.resolveReference(Variable.java:440)
at arb4j/arb.expressions.nodes.Variable.<init>(Variable.java:152)
at arb4j/arb.expressions.nodes.Variable.spliceInto(Variable.java:553)
at arb4j/arb.expressions.nodes.binary.Division.spliceInto(Division.java:58)
at arb4j/arb.expressions.nodes.binary.Subtraction.spliceInto(Subtraction.java:68)
at arb4j/arb.expressions.nodes.binary.BinaryOperation.substituteOperand(BinaryOperation.java:114)
at arb4j/arb.expressions.nodes.binary.BinaryOperation.substitute(BinaryOperation.java:86)
at arb4j/arb.expressions.nodes.binary.BinaryOperation.substituteOperand(BinaryOperation.java:125)
at arb4j/arb.expressions.nodes.binary.BinaryOperation.substitute(BinaryOperation.java:87)
at arb4j/arb.expressions.Expression.substitute(Expression.java:1860)
at arb4j/arb.expressions.ExpressionTest.testSubstitution(ExpressionTest.java:52)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Variable(#953742666).resolveReference(reference=x) expression=2*x²
Variable.Declaring x as the input node to 2*x² which currently has imput variable null
Variable(#311239812).resolveReference(reference=z) expression=½-z/2
Variable.Declaring z as the input node to ½-z/2 which currently has imput variable null
Expression(#129153987).substitute z➔½-(z/2) for x into x➔2*(x^2)
existingLiteralConstant=2 fieldName=cℤ1
existingLiteralConstant=2 fieldName=cℤ1
before subst:
-- 2*(x^2)
|-- 2
`-- x^2
|-- x
`-- 2
BinaryOperation.substitute(name=x, transformation=½-(z/2)) into this=2*(x^2)
BinaryOperation.substitute(name=x, transformation=½-(z/2)) into this=x^2
BinaryOperation.substituteOperand ½-(z/2) for x in x^2 of Expression(#129153987) expr=x➔2*(x^2)
Variable(#2073621255).resolveReference(reference=z) expression=x➔2*(x^2)
need to rename the input variable in the expression to that of the input of the target expression before doing the substitution.. also the rename/substitution should trigger a regeneration of the String representation of the expression (which if is expected to be able to be parsed again the prefix operator version of the ascending factorial I use for the general BinaryOperation implementation needs to be handled in the Exprssion.. either that or the code to transform the alphabet to subscripted UTF characters and print them out with the syntax that is parsed for now as it it appears in mathematics texts since forever
Variable(#953742666).resolveReference(reference=x) expression=2*x²
Variable.Declaring x as the input node to 2*x² which currently has imput variable null
Variable(#311239812).resolveReference(reference=z) expression=½-z/2
Variable.Declaring z as the input node to ½-z/2 which currently has imput variable null
Expression(#129153987).substitute z➔½-(z/2) for x into x➔2*(x^2)
existingLiteralConstant=2 fieldName=cℤ1
existingLiteralConstant=2 fieldName=cℤ1
before subst:
-- 2*(x^2)
|-- 2
`-- x^2
|-- x
`-- 2
BinaryOperation.substitute(name=x, transformation=½-(z/2)) into this=2*(x^2)
BinaryOperation.substitute(name=x, transformation=½-(z/2)) into this=x^2
BinaryOperation.substituteOperand ½-(z/2) for x in x^2 of Expression(#129153987) expr=x➔2*(x^2)
Variable(#2073621255).resolveReference(reference=z) expression=x➔2*(x^2)
java.lang.NoSuchFieldError: Class _2timesx² does not have member field 'arb.Real z'
at _2timesx².evaluate(Unknown Source)
at arb4j/arb.functions.real.RealFunction.evaluate(RealFunction.java:722)
at arb4j/arb.expressions.ExpressionTest.testSubstitution(ExpressionTest.java:60)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at junit@4.13.2/junit.framework.TestCase.runTest(TestCase.java:177)
at junit@4.13.2/junit.framework.TestCase.runBare(TestCase.java:142)
at junit@4.13.2/junit.framework.TestResult$1.protect(TestResult.java:122)
at junit@4.13.2/junit.framework.TestResult.runProtected(TestResult.java:142)
at junit@4.13.2/junit.framework.TestResult.run(TestResult.java:125)
at junit@4.13.2/junit.framework.TestCase.run(TestCase.java:130)
at junit@4.13.2/junit.framework.TestSuite.runTest(TestSuite.java:241)
at junit@4.13.2/junit.framework.TestSuite.run(TestSuite.java:236)
at junit@4.13.2/org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:757)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
java.lang.AssertionError: renameVariable(from=z, to=x)