commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Speirs <wspe...@apache.org>
Subject Re: Parsing and solving algebraic equation from string
Date Mon, 21 Jul 2014 12:39:18 GMT
Errr... nothing at the moment, but I'll make it Apache2 :-)

Bill-


On Mon, Jul 21, 2014 at 8:29 AM, Paul Libbrecht <paul@hoplahup.net> wrote:

> Coool. License?
>
> paul
>
>
> On 21 juil. 2014, at 14:26, William Speirs <wspeirs@apache.org> wrote:
>
> > It's certainly incomplete, but I started working on a CAS (Computer
> Algebra
> > System: http://en.wikipedia.org/wiki/Computer_algebra_system) that was
> > "backed" by commons-math: https://github.com/wspeirs/math
> >
> > The JJT (parser file for JavaCC) file can be found here, and is fairly
> > complete if I remember correctly:
> >
> https://raw.githubusercontent.com/wspeirs/Math/master/src/main/java/com/educatedsolutions/parser/Math.jjt
> >
> > I'd be happy to help you with it further and/or accept pull requests to
> > improve it :-)
> >
> > Bill-
> >
> >
> > On Mon, Jul 21, 2014 at 1:59 AM, Ted Dunning <ted.dunning@gmail.com>
> wrote:
> >
> >> On Sun, Jul 20, 2014 at 9:18 PM, Mansour Al Akeel <
> >> mansour.alakeel@gmail.com
> >>> wrote:
> >>
> >>> As Luc said, it will big project to write a parser that takes any
> >>> equation as a string, and generate the matrix (2-dimensional array) to
> >>> feed it into Commons Math.
> >>>
> >>
> >>
> >> It actually isn't a big project.
> >>
> >> See http://www.antlr.org/
> >>
> >> The simplest example they give there is this one:
> >>
> >> *grammar Expr;*
> >> *prog: (expr NEWLINE)* ; *
> >> *expr: expr ('*'|'/') expr *
> >> *    | expr ('+'|'-') expr *
> >> *    | INT | '(' expr ')' ; *
> >> *NEWLINE : [\r\n]+ ; INT : [0-9]+ ;*
> >>
> >> This will compile into a java program that parses expressions very much
> >> like what you want.
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message