0

My project: I want to develop a library that would solve equations. For example: Given input "3x+5=-1" I would like the output x=6

Why? Just for fun, I am learning and am interested in this topic.

What do I already have: I have already written a lexer and parser from scratch. So I am able to compute "3+6*3/(2^3)" etc.

What exactly do I want to do: Given my written lexer and parser (the process uses Reverse Polish Notation which I have researched how to do myself) I would like to expand it with variable recognition and then calculation of those variables. Basically solving linear equations.

My question: Where do I even start on implementing variables or solving equations. I would like to make it work for any linear equation. Just some resources or tips which I can expand upon myself. As this is a learning experience, external libraries are not a solution.

What I would like to do in the future: If I manage to conquer this problem I would like to expand the thing with equation simplification, quadratic equations etc.

How do I approach this? What kind of object structure would I need?

Cœur
  • 37,241
  • 25
  • 195
  • 267
K.Vovk
  • 101
  • 2
  • It's not needed to put in square brackets the language, you already tagged it ;) – LppEdd Mar 25 '19 at 21:10
  • Noted. Silly me. – K.Vovk Mar 25 '19 at 21:11
  • This is a very broad question and has been asked many times before. A good question should also demonstrate that you have done some research. There is no sense in us spending time writing an answer if the information is already easily available. Good luck with the project, in any case. – Michael Mar 25 '19 at 21:16
  • I understand. Will try to look some more. Thank you anyway. – K.Vovk Mar 25 '19 at 21:17
  • 1
    This is a duplicate question, however the suggested answer is not for this question. The tags should be "symbolical equation solver". Try looking into this one: https://stackoverflow.com/questions/35893913/java-solving-symbolic-algebraic-equations – Dr Phil Mar 25 '19 at 21:17
  • Oh I see. Will do. Thanks. "Symbolical equation solver" as you stated rang some new bells. – K.Vovk Mar 25 '19 at 21:23
  • @Michael your comment expresses irritation and annoyance which is not constructive. If you can't work constructively with people who are not well-informed, just steer away from their questions and let someone else deal with it. – Robert Dodier Mar 25 '19 at 23:24
  • @RobertDodier your comment expresses irritation and annoyance which is not constructive. If you can't work constructively with people who are not well-informed, just steer away from their questions and let someone else deal with it. – Michael Mar 25 '19 at 23:49
  • @Michael Stackoverflow is certainly a comfortable place for you, isn't it? You get to dump your frustrations and nobody can tell you any different. Carry on, then. Don't let me delay you; no doubt there is already another n00b who needs your stern, righteous hand. – Robert Dodier Mar 26 '19 at 01:14

0 Answers0