Skip to content

How to reverse an expression? #294

Answered by axkr
lalili asked this question in Q&A
Oct 4, 2021 · 1 comments · 4 replies
Discussion options

You must be logged in to vote

Don't know, if I understand exactly, but the Solve function can probably be used:

import org.matheclipse.core.eval.ExprEvaluator;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.parser.client.SyntaxError;
import org.matheclipse.parser.client.math.MathException;

public class GithubIssue294 {
  public static void main(String[] args) {
    try {
      ExprEvaluator util = new ExprEvaluator();
      IExpr f1 = util.eval("f1=10");
      // print: 10
      System.out.println(f1.toString());
      IExpr f2 = util.eval("f2=20");
      // print: 20
      System.out.println(f2.toString());
      IExpr result = util.eval("(f1+f2)*0.2");
      // print: 6.0
      System.out.println

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@lalili
Comment options

@lalili
Comment options

@TiagoCavalcante
Comment options

@lalili
Comment options

Answer selected by axkr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants