commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: Parsing and solving algebraic equation from string
Date Tue, 29 Jul 2014 22:11:38 GMT
Michael,
Indeed I am looking for a parser that can give me an array that math
commons can accept. So iterating over the coefficients taking the
order in account is necessary.
For example:

3x + 7 - 8    ---> an array [3 -1]
2x - x^2 + 9 - 4  ---> [1 2 5]


I was looking into Bills work, and trying to see how to get it to do
this. I have worked long time ago with javacc, but not that strong
with JJTree and AST processing, so reading and refreshing my memory
now.

Thank you.


On Tue, Jul 29, 2014 at 1:00 PM, Michael Pigott
<mpigott.subscriptions@gmail.com> wrote:
> Bill,
>     My interpretation of Mansour's original question was that he had an
> equation in the form "x + 3 = 10" and he needed to have a computer tell him
> x = 7.  SymJa appears to solve more complex problems that that, at least
> from the limited documentation I saw, so it may be helpful?
>     As for the rest - got it.  There are too many ways to describe
> mathematical equations; I was just curious which one you were going for.
>
> Thanks, and good luck!
> Mike
>
>
> On Tue, Jul 29, 2014 at 11:21 AM, William Speirs <wspeirs@apache.org> wrote:
>
>> Someone else who is more experienced please jump-in here. My $0.02...
>>
>> 1. Would this be significantly different from SymJa?
>> > https://bitbucket.org/axelclk/symja_android_library/wiki/Home
>>
>>
>> I think we're talking about two different thing:
>>
>> 1) Mansour was asking for a library that can take a string and returned
>> some sort of AST for mathematical equations. Maybe it would also produce a
>> tree of components that are found in commons-math.
>>
>> 2) I'm looking at/working on a GUI that can take a string, display it in
>> LaTex output, and also produce a tree structure of components found in
>> commons-math. Then this tree would be evaluated/interpreted to produce an
>> output for the user. My project is akin to commons-math + parser +
>> evaluator/interpreter.
>>
>> I don't know enough about SymJa, but it looks to be much closer to #2 than
>> #1 -- which isn't to say that it doesn't already contain #1 in it. It looks
>> like JAS (which SymJa uses) does a lot of this:
>> http://krum.rz.uni-mannheim.de/jas/
>>
>>
>> > 2. Should this be an implementation of an existing spec, like RPN or
>> > MathML, or do we need a new one?
>> >
>>
>> My goal was to match the Maple "spec" as closely as possible. It's fairly
>> close to LaTex (again, LaTex has more syntax for formatting than needed
>> here). I went with that primarily because I know Maple and didn't know
>> about RPN or MathML :-) Also, I'm looking for things like A := 2*x + 3
>> where you're assigning an equation to the "variable" A.
>>
>>
>> > 3. Will the language be interpreted, or will Java code be generated, or
>> > will JSR 199 be used to invoke the Java compiler?
>> >
>>
>> My thought would be the resulting tree structure from after parsing would
>> be evaluated/interpreted and the result presented to the user.
>>
>> The site seems to be down, but I think you can play around with a demo
>> version of Maple here: http://www.maplesoft.com/products/maple/demo/
>>
>> That is what I'm going for... thoughts?
>>
>> Bill-
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message