commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [math] Improvement: Interpreter for mathematical expressions
Date Tue, 27 Mar 2012 12:18:04 GMT
On Tue, Mar 27, 2012 at 5:50 AM, sebb <sebbaz@gmail.com> wrote:

> 2012/3/27 "Detlef G√ľnther" <Detlef.Guenther@gmx.net>:
> > Hello,
> >
> > it would be nice to have an interpreter for mathematical expressions so
> that functions may be defined at runtime.
> >
> > Example for f(x):
> >
> >  ExpInter ei = new ExpInter();
> >  ei.setFunction("ln(3*sin(2*x)+3)");
> >  // Plot the function:
> >  for (double x=0.0;x<3.0;x+=0.1) {
> >    y = ei(x);
> >    // ... do something useful with x,y
> >  }
> >
>
> Seems completely out of scope for Math to me.
>
> Besides, there are already scripting languages such as Commons JEXL
> and BeanShell.
>

JavaScript is also baked in Java 6 and you can use any Java scripting
enabled engine.

Gary


> These can call just about any method you want, and BeanShell allows
> one to define functions.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

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