java - How to parse mathematical expressions -


i'd understand how java program geogebra can read mathematical expression exp(z^2) textbox , evaluate it. familiar matlab: how implement function handles in java?

if evaluating mathematical expressions (infix), using java, recommend simple approach first converting expression postfix notation , following basic algorithm evaluating postfix.

take here

  1. expression a*b+c
  2. postfix ab*c+
  3. read postfix string, if operand, push stack. (in stack -> a,b)
  4. if operator(*), pop out 2 operands, perform calculation (a*b = e,say).
  5. push result e in stack
  6. goto step 3.

the end result in stack answer.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -