Symja - Java computer algebra library - https://github.com/axkr/symja_android_library
axkr on master
clean up Fix #525 - Series of rational f… (compare)
dependabot[bot] on maven
axkr on master
Bump RoaringBitmap from 0.9.28 … (compare)
dependabot[bot] on maven
Bump RoaringBitmap from 0.9.28 … (compare)
axkr on master
clean up Define INumber#isZero(double to… WIP #538 Implement solving meth… (compare)
axkr on master
Fix #543 don't cast ClassLoader… (compare)
dependabot[bot] on maven
axkr on master
Bump lucene-analyzers-common fr… (compare)
deMorgan1
/deMorgan2
replacements are doing
The BooleanVariables() function use this internally https://github.com/axkr/symja_android_library/blob/master/symja_android_library/doc/functions/BooleanVariables.md
@axkr Is there a way of outputting the list/set created by BooleanVariables() or Variables() to a Java list or Java array?
IExpr calcExpr = evaluator.eval("Variables(" + calc + ")");
and calc
being my formula
getVariablesArray(calcExpr);
@axkr In https://github.com/axkr/symja_android_library/blob/d1e78f694be9b7b0bea4abbacbd924c8512adc38/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java#L3907 there is the following part of the code:
String autoload = ".\\Autoload";
if (FEConfig.PARSER_USE_LOWERCASE_SYMBOLS) {
autoload = ".\\AutoloadSymja";
}
File sourceLocation = new File(autoload);
Symja creates a file here. Since I'm writing an Elasticsearch plugin, creating files doesn't seem to be allowed. Is there a way of using Symja without addtional files being implicitly created by ExprEvaluator
?
try {
String autoload = ".\\Autoload";
if (FEConfig.PARSER_USE_LOWERCASE_SYMBOLS) {
autoload = ".\\AutoloadSymja";
}
File sourceLocation = new File(autoload);
final String[] files = sourceLocation.list();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].endsWith(".m")) {
File sourceFile = new File(sourceLocation, files[i]);
FileFunctions.Get.loadPackage(EvalEngine.get(), sourceFile);
}
}
}
} catch (java.security.AccessControlException acex) {
// no read access for current user
acex.printStackTrace();
} catch (RuntimeException ex) {
ex.printStackTrace();
}
@axkr Following output if I place this test right in front of the part of my plugin that crashes when executed:
[2021-05-14T00:21:32,244][WARN ][stderr ] [TIM] java.security.AccessControlException: access denied ("java.io.FilePermission" ".\AutoloadSymja" "read")
[2021-05-14T00:21:32,245][WARN ][stderr ] [TIM] at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
[2021-05-14T00:21:32,246][WARN ][stderr ] [TIM] at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)
[2021-05-14T00:21:32,246][WARN ][stderr ] [TIM] at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)
[2021-05-14T00:21:32,246][WARN ][stderr ] [TIM] at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:747)
[2021-05-14T00:21:32,247][WARN ][stderr ] [TIM] at java.base/java.io.File.list(File.java:1131)
[2021-05-14T00:21:32,247][WARN ][stderr ] [TIM] at org.elasticsearch.index.search.CommutingQuantumScorer.score(CommutingQuantumScorer.java:96)
...
(The last method before I skipped the rest is the method I placed the test in.)
formulaEvaluator.eval("deMorganDisCon = {x_ || y_ :> !(!x && !y)}");
formulaEvaluator.eval("deMorganConDis = {x_ && y_ :> !(!x || !y)}");
Something like this? ^-^' @axkr
private static final Logger logger = LogManager.getLogger(F.class);
...
...
try {
...
...
} catch (java.security.AccessControlException acex) {
// no read access for current user
logger.warn("Cannot read packages in autoload folder:", acex);
} catch (RuntimeException ex) {
logger.error(ex);
}
@axkr Also, part of Symja seems to need the RuntimePermission "shutdownHooks":
[2021-05-14T17:52:09,382][WARN ][stderr ] [TIM] java.lang.ExceptionInInitializerError
[2021-05-14T17:52:09,382][WARN ][stderr ] [TIM] at org.matheclipse.core.expression.F.<clinit>(F.java:599)
[2021-05-14T17:52:09,383][WARN ][stderr ] [TIM] at org.matheclipse.core.eval.ExprEvaluator.<clinit>(ExprEvaluator.java:133)
...
[2021-05-14T17:52:09,391][WARN ][stderr ] [TIM] Caused by: org.apfloat.ApfloatConfigurationException: Error setting property "cleanupAtExit" to value "true"
[2021-05-14T17:52:09,392][WARN ][stderr ] [TIM] at org.apfloat.ApfloatContext.setProperty(ApfloatContext.java:1025)
[2021-05-14T17:52:09,392][WARN ][stderr ] [TIM] at org.apfloat.ApfloatContext.setProperties(ApfloatContext.java:1270)
[2021-05-14T17:52:09,392][WARN ][stderr ] [TIM] at org.apfloat.ApfloatContext.<init>(ApfloatContext.java:331)
[2021-05-14T17:52:09,392][WARN ][stderr ] [TIM] at org.apfloat.ApfloatContext.<clinit>(ApfloatContext.java:1388)
[2021-05-14T17:52:09,393][WARN ][stderr ] [TIM] ... 28 more
[2021-05-14T17:52:09,393][WARN ][stderr ] [TIM] Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "shutdownHooks")
[2021-05-14T17:52:09,393][WARN ][stderr ] [TIM] at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
...
I assume it is caused by the property cleanupAtExit
. Is it possible to not let it being set to true
?
ctx.setCleanupAtExit(false);
ApfloatContext ctx = ApfloatContext.getContext();
ctx.setNumberOfProcessors(1);
ctx.setCleanupAtExit(false);