Post Reply 
Request for suggestions: algebraic equations in Free42
07-14-2020, 07:41 PM
Post: #38
RE: Request for suggestions: algebraic equations in Free42
(07-08-2020 09:16 PM)Thomas Okken Wrote:  I am looking for inspiration about how to approach the algebraic equations in particular.

Well, how difficult it is to implement algebraic equations depends on what limits you put on what is considered an "algebraic equation".

For example, if you want to support basic arithmetic operators, such as "+" , "-" , "/" , "*" , "^" etc., functions with a variable number of arguments eg. "F(X,Y)", and variables, then you could use Dijkstra's Shunting-yard algorithm, with lazy evaluation, to easily parse such equations into an intermediate format such as an abstract syntax tree ( AST ). The AST can be used as the internal representation for algebraic equations. Also, you'd need to implement a term re-writing system that operates on the ASTs.

If you want more complex syntax in your expressions, then you may need to use an operator precedence parser, or even a recursive descent LL(1) or shift-reduce bottom-up LALR(1) parser.

Ideally, you probably wouldn't want to reinvent the wheel and instead use a third-party library, but, I don't know if there are any good third-party CAS libraries that are licensed under the GNU LGPL -- eg. Xcas / Giac is dual licensed under the GNU GPL and a commercial license, so, you'd have to pay royalties to use it if you want to sell a paid version of Free42.

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Request for suggestions: algebraic equations in Free42 - Jonathan Busby - 07-14-2020 07:41 PM



User(s) browsing this thread: 1 Guest(s)