-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/crowlogic/arb4j/issues/253
- Loading branch information
Showing
4 changed files
with
202 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
package arb.functions.real; | ||
|
||
import arb.Initializable; | ||
import arb.Integer; | ||
import arb.Real; | ||
import arb.Typesettable; | ||
|
||
/** | ||
* <pre> | ||
parseRoot x➔∂a*x+b*x²+c*x³/∂x of Expression(#1383524016) | ||
Variable(#1686100174).resolveReference(reference=a) expression=x➔∂a*x+b*x²+c*x³/∂x | ||
Declaring a as a contextual variable of type class arb.Real | ||
Variable(#1846406218).resolveReference(reference=b) expression=x➔∂a*x+b*x²+c*x³/∂x | ||
Declaring b as a contextual variable of type class arb.Real | ||
Variable(#2081191879).resolveReference(reference=c) expression=x➔∂a*x+b*x²+c*x³/∂x | ||
Declaring c as a contextual variable of type class arb.Real | ||
Instantiating (a+(b*(2*(x^(2-1)))))+(c*(3*(x^(3-1)))) | ||
Expression(#1383524016).defineClass(expression=x➔∂a*x+b*x²+c*x³/∂x | ||
,className=x-∂a*x+b*x²+c*x³⁄∂x | ||
, context=Context(#1559122513)[functions=[],variables=Variables(#1128096251)[[arb.Real:a=0, arb.Real:b=0, arb.Real:c=0]]]) | ||
Expression(#1383524016).generate() className=x-∂a*x+b*x²+c*x³⁄∂x | ||
Expression(#1383524016) Generating x➔∂a*x+b*x²+c*x³/∂x | ||
generate (a+(b*(2*(x^(2-1)))))+(c*(3*(x^(3-1)))) | ||
BinaryOperation.generate( this=(a+(b*(2*(x^(2-1)))))+(c*(3*(x^(3-1)))), | ||
left=a+(b*(2*(x^(2-1))))(AdditionNode), | ||
left.type=interface arb.functions.real.RealFunction, | ||
operation=add, | ||
right=c*(3*(x^(3-1)))(MultiplicationNode), | ||
right.type=interface arb.functions.real.RealFunction, | ||
resultType=interface arb.functions.real.RealFunction ) | ||
BinaryOperation.generate( this=a+(b*(2*(x^(2-1)))), | ||
left=a(VariableNode), | ||
left.type=class arb.Real, | ||
operation=add, | ||
right=b*(2*(x^(2-1)))(MultiplicationNode), | ||
right.type=interface arb.functions.real.RealFunction, | ||
resultType=interface arb.functions.real.RealFunction ) | ||
Variable(#1686100174).generate( this=a, resultType=class arb.Real) | ||
BinaryOperation.generate( this=b*(2*(x^(2-1))), | ||
left=b(VariableNode), | ||
left.type=class arb.Real, | ||
operation=mul, | ||
right=2*(x^(2-1))(MultiplicationNode), | ||
right.type=interface arb.functions.real.RealFunction, | ||
resultType=interface arb.functions.real.RealFunction ) | ||
Variable(#1846406218).generate( this=b, resultType=class arb.Real) | ||
BinaryOperation.generate( this=2*(x^(2-1)), | ||
left=2(LiteralConstantNode), | ||
left.type=class arb.Integer, | ||
operation=mul, | ||
right=x^(2-1)(ExponentiationNode), | ||
right.type=interface arb.functions.real.RealFunction, | ||
resultType=interface arb.functions.real.RealFunction ) | ||
BinaryOperation.generate( this=x^(2-1), | ||
left=x(VariableNode), | ||
left.type=interface arb.functions.real.RealFunction, | ||
operation=pow, | ||
right=2-1(SubtractionNode), | ||
right.type=class arb.Integer, | ||
resultType=interface arb.functions.real.RealFunction ) | ||
Variable(#153245266).generate( this=x, resultType=interface arb.functions.real.RealFunction) | ||
* </pre> | ||
* | ||
*/ | ||
public class xRealFunc implements | ||
RealFunctional<Object, RealFunction>, | ||
Typesettable, | ||
AutoCloseable, | ||
Initializable | ||
{ | ||
public boolean isInitialized; | ||
public final Integer cℤ2 = new Integer("3"); | ||
public final Integer cℤ1 = new Integer("2"); | ||
public final Integer cℤ4 = new Integer("1"); | ||
public final Integer cℤ3 = new Integer("0"); | ||
public Real a; | ||
public Real b; | ||
public Real c; | ||
public RealFunction ifuncℝ4 = new RealFunction(); | ||
public RealFunction ifuncℝ5 = new RealFunction(); | ||
public RealFunction ifuncℝ6 = new RealFunction(); | ||
public Integer iℤ2 = new Integer(); | ||
public Integer iℤ1 = new Integer(); | ||
public RealFunction ifuncℝ7 = new RealFunction(); | ||
public RealFunction ifuncℝ1 = new RealFunction(); | ||
public RealFunction ifuncℝ2 = new RealFunction(); | ||
public RealFunction ifuncℝ3 = new RealFunction(); | ||
public RealFunction ifuncℝ10 = new RealFunction(); | ||
public RealFunction ifuncℝ8 = new RealFunction(); | ||
public RealFunction ifuncℝ9 = new RealFunction(); | ||
|
||
@Override | ||
public Class<RealFunction> coDomainType() | ||
{ | ||
return RealFunction.class; | ||
} | ||
|
||
@Override | ||
public RealFunction evaluate(Object in, int order, int bits, RealFunction result) | ||
{ | ||
if (!isInitialized) | ||
{ | ||
initialize(); | ||
} | ||
|
||
return a.add(b.mul(cℤ1.mul(ifuncℝ1.identity().pow(cℤ1.sub(cℤ4, bits, iℤ1), bits, ifuncℝ2), bits, ifuncℝ3), | ||
bits, | ||
ifuncℝ4), | ||
bits, | ||
ifuncℝ5) | ||
.add(c.mul(cℤ2.mul(ifuncℝ6.identity().pow(cℤ2.sub(cℤ4, bits, iℤ2), bits, ifuncℝ7), bits, ifuncℝ8), | ||
bits, | ||
ifuncℝ9), | ||
bits, | ||
ifuncℝ10); | ||
} | ||
|
||
@Override | ||
public void initialize() | ||
{ | ||
if (isInitialized) | ||
{ | ||
throw new AssertionError("Already initialized"); | ||
} | ||
else if (a == null) | ||
{ | ||
throw new AssertionError("x-∂a*x+b*x²+c*x³⁄∂x.a is null"); | ||
} | ||
else if (b == null) | ||
{ | ||
throw new AssertionError("x-∂a*x+b*x²+c*x³⁄∂x.b is null"); | ||
} | ||
else if (c == null) | ||
{ | ||
throw new AssertionError("x-∂a*x+b*x²+c*x³⁄∂x.c is null"); | ||
} | ||
else | ||
{ | ||
isInitialized = true; | ||
} | ||
} | ||
|
||
@Override | ||
public void close() | ||
{ | ||
cℤ2.close(); | ||
cℤ1.close(); | ||
cℤ4.close(); | ||
cℤ3.close(); | ||
ifuncℝ4.close(); | ||
ifuncℝ5.close(); | ||
ifuncℝ6.close(); | ||
iℤ2.close(); | ||
iℤ1.close(); | ||
ifuncℝ7.close(); | ||
ifuncℝ1.close(); | ||
ifuncℝ2.close(); | ||
ifuncℝ3.close(); | ||
ifuncℝ10.close(); | ||
ifuncℝ8.close(); | ||
ifuncℝ9.close(); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "x➔∂a*x+b*x²+c*x³/∂x"; | ||
} | ||
|
||
@Override | ||
public String typeset() | ||
{ | ||
return "a + b \\cdot 2 \\cdot {x}^{(\\left(2-1\\right))} + c \\cdot 3 \\cdot {x}^{(\\left(3-1\\right))}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,4 @@ TODO: builtin sykbols for the classical orthogonal polynomials | |
"limit" is null at arb4j/arb.expressions.nodes.IntegralNode.evaluateIndefiniteIntegralAt(IntegralNode.java:217) | ||
todo: mouse wheel zooms control or whole scene | ||
expr compiler: fractional derivatices | ||
arb.exceptions.CompilerException: Could not determine resultant type for this=0*x where left.type=class arb.Integer and right.type=interface arb.functions.real.RealFunction in 0*x at position=21at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.type(BinaryOperationNode.java:391)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.type(BinaryOperationNode.java:362)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.type(BinaryOperationNode.java:362)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.formatGenerationParameters(BinaryOperationNode.java:167)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:186)at arb4j/arb.expressions.nodes.DerivativeNode.generate(DerivativeNode.java:141)at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:940)at arb4j/arb.expressions.Expression.generate(Expression.java:787)at arb4j/arb.expressions.Expression.defineClass(Expression.java:570)at arb4j/arb.expressions.Expression.getInstance(Expression.java:1218)at arb4j/arb.expressions.Expression.instantiate(Expression.java:1367)at arb4j/arb.functions.Function.instantiate(Function.java:126)at arb4j/arb.functions.Function.express(Function.java:89)at arb4j/arb.functions.real.RealFunctional.express(RealFunctional.java:34)at arb4j/arb.functions.real.RealFunctional.express(RealFunctional.java:21)at arb4j/arb.expressions.ExpressionTest.testRealFunctionDerivative(ExpressionTest.java:94)at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)at java.base/java.lang.reflect.Method.invoke(Method.java:580)at [email protected]/junit.framework.TestCase.runTest(TestCase.java:177)at [email protected]/junit.framework.TestCase.runBare(TestCase.java:142)at [email protected]/junit.framework.TestResult$1.protect(TestResult.java:122)at [email protected]/junit.framework.TestResult.runProtected(TestResult.java:142)at [email protected]/junit.framework.TestResult.run(TestResult.java:125)at [email protected]/junit.framework.TestCase.run(TestCase.java:130)at [email protected]/junit.framework.TestSuite.runTest(TestSuite.java:241)at [email protected]/junit.framework.TestSuite.run(TestSuite.java:236)at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:530)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:758)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:453)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211) | ||
java.lang.AssertionError: reference type should not be an Object or an interfaceat arb4j/arb.expressions.nodes.VariableNode.generateReferenceToIndeterminantVariable(VariableNode.java:289)at arb4j/arb.expressions.nodes.VariableNode.generateReference(VariableNode.java:250)at arb4j/arb.expressions.nodes.VariableNode.generate(VariableNode.java:201)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:192)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:190)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:190)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:190)at arb4j/arb.expressions.nodes.DerivativeNode.generate(DerivativeNode.java:141)at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:940)at arb4j/arb.expressions.Expression.generate(Expression.java:787)at arb4j/arb.expressions.Expression.defineClass(Expression.java:570)at arb4j/arb.expressions.Expression.getInstance(Expression.java:1218)at arb4j/arb.expressions.Expression.instantiate(Expression.java:1367)at arb4j/arb.functions.Function.instantiate(Function.java:126)at arb4j/arb.functions.polynomials.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:35)at arb4j/arb.functions.polynomials.RealPolynomialNullaryFunction.express(RealPolynomialNullaryFunction.java:47)at arb4j/arb.expressions.ExpressionTest.testRealPolynomialDerivative(ExpressionTest.java:84)at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)at java.base/java.lang.reflect.Method.invoke(Method.java:580)at [email protected]/junit.framework.TestCase.runTest(TestCase.java:177)at [email protected]/junit.framework.TestCase.runBare(TestCase.java:142)at [email protected]/junit.framework.TestResult$1.protect(TestResult.java:122)at [email protected]/junit.framework.TestResult.runProtected(TestResult.java:142)at [email protected]/junit.framework.TestResult.run(TestResult.java:125)at [email protected]/junit.framework.TestCase.run(TestCase.java:130)at [email protected]/junit.framework.TestSuite.runTest(TestSuite.java:241)at [email protected]/junit.framework.TestSuite.run(TestSuite.java:236)at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:530)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:758)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:453)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211) | ||
junit.framework.AssertionFailedError: expected:<-0.2897102277656836133548571248961385757265> but was:<-0.0166300891695288>at [email protected]/junit.framework.Assert.fail(Assert.java:57)at [email protected]/junit.framework.Assert.failNotEquals(Assert.java:329)at [email protected]/junit.framework.Assert.assertEquals(Assert.java:78)at [email protected]/junit.framework.Assert.assertEquals(Assert.java:86)at [email protected]/junit.framework.TestCase.assertEquals(TestCase.java:246)at arb4j/arb.expressions.ExpressionTest.testFourierTransformOfType1ChebyshevPolynomials(ExpressionTest.java:95)at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)at java.base/java.lang.reflect.Method.invoke(Method.java:580)at [email protected]/junit.framework.TestCase.runTest(TestCase.java:177)at [email protected]/junit.framework.TestCase.runBare(TestCase.java:142)at [email protected]/junit.framework.TestResult$1.protect(TestResult.java:122)at [email protected]/junit.framework.TestResult.runProtected(TestResult.java:142)at [email protected]/junit.framework.TestResult.run(TestResult.java:125)at [email protected]/junit.framework.TestCase.run(TestCase.java:130)at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:530)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:758)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:453)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211) | ||
java.lang.RuntimeException: unrecognized type interface arb.functions.real.RealFunctionat arb4j/arb.expressions.Compiler.getVariablePrefix(Compiler.java:342)at arb4j/arb.expressions.Expression.getNextIntermediateVariableFieldName(Expression.java:1243)at arb4j/arb.expressions.Expression.newIntermediateVariable(Expression.java:1517)at arb4j/arb.expressions.Expression.newIntermediateVariable(Expression.java:1497)at arb4j/arb.expressions.Expression.newIntermediateVariable(Expression.java:1492)at arb4j/arb.expressions.Expression.allocateIntermediateVariable(Expression.java:386)at arb4j/arb.expressions.nodes.VariableNode.generateReferenceToIndeterminantVariable(VariableNode.java:295)at arb4j/arb.expressions.nodes.VariableNode.generateReference(VariableNode.java:250)at arb4j/arb.expressions.nodes.VariableNode.generate(VariableNode.java:201)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:197)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:199)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:199)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:199)at arb4j/arb.expressions.nodes.binary.BinaryOperationNode.generate(BinaryOperationNode.java:197)at arb4j/arb.expressions.nodes.DerivativeNode.generate(DerivativeNode.java:139)at arb4j/arb.expressions.Expression.generateEvaluationMethod(Expression.java:940)at arb4j/arb.expressions.Expression.generate(Expression.java:787)at arb4j/arb.expressions.Expression.defineClass(Expression.java:570)at arb4j/arb.expressions.Expression.getInstance(Expression.java:1218)at arb4j/arb.expressions.Expression.instantiate(Expression.java:1367)at arb4j/arb.functions.Function.instantiate(Function.java:126)at arb4j/arb.functions.Function.express(Function.java:89)at arb4j/arb.functions.real.RealFunctional.express(RealFunctional.java:34)at arb4j/arb.functions.real.RealFunctional.express(RealFunctional.java:21)at arb4j/arb.expressions.ExpressionTest.testRealFunctionDerivative(ExpressionTest.java:149)at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)at java.base/java.lang.reflect.Method.invoke(Method.java:580)at [email protected]/junit.framework.TestCase.runTest(TestCase.java:177)at [email protected]/junit.framework.TestCase.runBare(TestCase.java:142)at [email protected]/junit.framework.TestResult$1.protect(TestResult.java:122)at [email protected]/junit.framework.TestResult.runProtected(TestResult.java:142)at [email protected]/junit.framework.TestResult.run(TestResult.java:125)at [email protected]/junit.framework.TestCase.run(TestCase.java:130)at [email protected]/junit.framework.TestSuite.runTest(TestSuite.java:241)at [email protected]/junit.framework.TestSuite.run(TestSuite.java:236)at [email protected]/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:530)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:758)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:453)at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:211) |