Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
cbba8dd
MethodHandles work for algebraic expressions. Rich functionality not …
gbenroscience Mar 11, 2026
3b68ef6
work on MethodHandles coming along well. Almost 3x faster than the in…
gbenroscience Mar 11, 2026
30e7226
FlatMatrixTurboCompiler works-- it is now a highly optimized engine c…
gbenroscience Mar 12, 2026
86e5ffd
ScalarTurboCompiler now enjoys full integration(not tested) into Pars…
gbenroscience Mar 12, 2026
06be1e3
eigenvalues work, but do not support complex eigenvalues
gbenroscience Mar 12, 2026
4d8b08f
disabled scanner from evaluating parts of anonymous functions and fun…
gbenroscience Mar 12, 2026
40d8def
about to modify compileToPostfix to accomdate Token.rawArgs field
gbenroscience Mar 13, 2026
2a1e527
first attempt at Token.rawArgs was quite good. Come to this commit to…
gbenroscience Mar 14, 2026
ec93502
method-handles going over and above...numerical integrals now benchma…
gbenroscience Mar 14, 2026
f3fd0a0
save state... testng NumericalIntegration, set to hardcode lookup tab…
gbenroscience Mar 16, 2026
35dee3b
Integration now includes lookup tables for 8,16,32 and 64 glpoints
gbenroscience Mar 16, 2026
227a704
trying to use chebyshev and hardening principles to make integration …
gbenroscience Mar 17, 2026
372468f
making some headway with timeouts-- backup here if special handling f…
gbenroscience Mar 17, 2026
2ecc0f4
now detects error for highly oscillatory functions
gbenroscience Mar 17, 2026
00d6a7c
world class integration engine---but we need to fix the double-integr…
gbenroscience Mar 18, 2026
874b51c
save NumericalIntegrator born
gbenroscience Mar 18, 2026
d7097d1
finished integration and printing integration
gbenroscience Mar 18, 2026
9fe5348
method handles integration with root finder
gbenroscience Mar 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
575 changes: 575 additions & 0 deletions INTEGRATOR.md

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>bytecode</word>
<word>Runtime</word>
</spellchecker-wordlist>
</project-shared-configuration>
15 changes: 11 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.gbenroscience</groupId>
<artifactId>parser-ng</artifactId>
<version>0.2.6</version>
<version>1.0.0</version>
<packaging>jar</packaging>
<!--
I started this project 2009 and have been upgrading it since then.
Expand All @@ -12,7 +12,7 @@
-->

<name>ParserNG</name>
<description>Rich and Performant, Cross Platform Java Library(100% Java)... Major optimizations in constant folding, strength reduction, and frame(array) based argument passing to enforce O(1) (faster than Map based) passing of arguments during the evaluation phase.
<description>Rich and Performant, Cross Platform Java Library(100% Java)...Version 1.0.0 explodes even higher in execution speed.
</description>
<url>https://github.com/gbenroscience/ParserNG</url>

Expand Down Expand Up @@ -40,15 +40,22 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<version>6.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<version>6.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>6.0.3</version>
<scope>test</scope>
<type>jar</type>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,15 @@ public ArrayList<String> differentiateAsList() {

return array;
}//end method



/**
*
*
* @param name The name to check.
* @return true if the name is automatically generated and
* so, most likely refers to a stored Differentiable.
* @return true if the name is automatically generated and so, most likely
* refers to a stored Differentiable.
*/
public boolean isBaseVariable(String name){
return name.equals(this.baseVariable);
public boolean isBaseVariable(String name) {
return name.equals(this.baseVariable);
}//end method

/**
Expand All @@ -197,19 +196,17 @@ public boolean isBaseVariable(String name){
* value is returned.
*
*/
public static String eval(String expr) {
public static MathExpression.EvalResult eval(String expr) {
//the anonymous function to be differentiated: e.g.diff(@(p)(3*p^3+2*p^2-8*p+1),1)
try {
Parser p = new Parser(expr);



if (p.result == ParserResult.VALID) {

expr = "diff(" + p.getFunction().getMathExpression().getExpression() + ")";
String baseVariable = p.getFunction().getIndependentVariables().get(0).getName();

int orderOfDiff = p.getOrderOfDifferentiation();
if(p.isNotSetOrderOfDiff()){
if (p.isNotSetOrderOfDiff()) {
orderOfDiff = 1;
}

Expand All @@ -223,33 +220,58 @@ public static String eval(String expr) {
}//end for loop
expr = expr.substring(5, expr.length() - 1);
MathExpression me = new MathExpression(baseVariable + "=" + evalPoint + ";" + expr);
return me.solve();
System.out.println(baseVariable + "=" + evalPoint + ";" + expr);
me.updateArgs(evalPoint);
return me.solveGeneric();
} else {
for (int i = 1; i <= orderOfDiff; i++) {
Derivative derivative = new Derivative(expr);
derivative.baseVariable = baseVariable;
expr = "diff(" + derivative.differentiate() + ")";
}//end for loop
expr = expr.substring(5, expr.length() - 1);
String funcExpr = "@("+baseVariable+")"+expr;

String funcExpr = "@(" + baseVariable + ")" + expr;

Function f = FunctionManager.add(funcExpr);
return f.getName();
return f.getMathExpression().getNextResult().wrap(f.getName());
//return funcExpr;
}
}
return "Input Error!!!";
return new MathExpression.EvalResult().wrap(ParserResult.STRANGE_INPUT);
} catch (Exception e) {
e.printStackTrace();
return "Input Error";
return new MathExpression.EvalResult().wrap(ParserResult.STRANGE_INPUT);
}
}

/**
* @param args
*/
public static void main(String args[]) {
String f = "10*x^5";
Derivative d;
try {
d = new Derivative(f);
System.out.println("diff(" + f + ") = " + d.differentiate());
} catch (Exception ex) {
Logger.getLogger(Derivative.class.getName()).log(Level.SEVERE, null, ex);
}



f = "diff(@(x)10*x^5,3)";
try {
MathExpression.EvalResult ev = Derivative.eval(f);
String res = ev.textRes;
System.out.println("diff(" + f + ") = " + res);
System.out.println("Grad Function = " + FunctionManager.lookUp(res));

} catch (Exception ex) {
Logger.getLogger(Derivative.class.getName()).log(Level.SEVERE, null, ex);
}


try {
//MAKE DECISION ON WHETHER TO ENABLE (-x+...
//OR TO DISABLE IT. ENABLING IT WILL MEAN CONVERTING -x patterns to -1*x....
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public class Parser {
public Parser(String expression) {

DataSetFormatter dsf = new DataSetFormatter(expression);
List<String> scanner = dsf.getDataset();

List<String> scanner = dsf.getDataset();
scanner = MathScanner.plusAndMinusStringHandlerHelper(scanner);
MathScanner.recognizeAnonymousFunctions(scanner);

this.function = localParseDerivativeCommand(scanner);
Expand Down
Loading
Loading