@@ -4395,7 +4395,7 @@ public static IAST Symmetric(final IExpr a0) {
4395
4395
}
4396
4396
4397
4397
/**
4398
- * Converts an arbitrary expression to a type that can be used inside Symja.
4398
+ * Converts and evaluates arbitrary expressiona to a Symja type .
4399
4399
*
4400
4400
* <pre>
4401
4401
* Java Object -> Symja object
@@ -4423,20 +4423,41 @@ public static IAST Symmetric(final IExpr a0) {
4423
4423
*
4424
4424
*/
4425
4425
public static IExpr symjify (final Object object ) {
4426
- return Object2Expr .convert (object );
4426
+ return symjify (object , true );
4427
+ }
4428
+
4429
+ public static IExpr symjify (final Object object , boolean evaluate ) {
4430
+ IExpr temp = Object2Expr .convert (object );
4431
+ return evaluate ? eval (temp ) : temp ;
4432
+ }
4433
+
4434
+ /**
4435
+ * Parses and evaluates a Java string to a Symja expression. May throw an SyntaxError exception, if the string couldn't be parsed.
4436
+ *
4437
+ * @param str
4438
+ * the epression which should be parsed
4439
+ * @return
4440
+ * @throws SyntaxError
4441
+ */
4442
+ public static IExpr symjify (final String str ) throws SyntaxError {
4443
+ return symjify (str , true );
4427
4444
}
4428
4445
4429
4446
/**
4430
4447
* Parses a Java string to a Symja expression. May throw an SyntaxError exception, if the string couldn't be parsed.
4431
4448
*
4432
4449
* @param str
4433
4450
* the epression which should be parsed
4451
+ * @param evaluate
4452
+ * if true evaluate the parsed string
4434
4453
* @return
4435
4454
* @throws SyntaxError
4436
4455
*/
4437
- public static IExpr symjify (final String str ) throws SyntaxError {
4438
- ExprParser parser = new ExprParser (EvalEngine .get ());
4439
- return parser .parse (str );
4456
+ public static IExpr symjify (final String str , boolean evaluate ) throws SyntaxError {
4457
+ EvalEngine engine = EvalEngine .get ();
4458
+ ExprParser parser = new ExprParser (engine );
4459
+ IExpr temp = parser .parse (str );
4460
+ return evaluate ? engine .evaluate (temp ) : temp ;
4440
4461
}
4441
4462
4442
4463
public static IExpr symjify (final long value ) {
0 commit comments