Re: user math expression evaluation

2013-05-29 Thread Brian Craft
core.matrix, I mean. On Wednesday, May 29, 2013 3:19:02 PM UTC-7, Brian Craft wrote: This looks useful. Is it tied to jvm? On Tuesday, May 28, 2013 6:21:30 PM UTC-7, Mikera wrote: On Wednesday, 29 May 2013 02:19:41 UTC+8, Brian Craft wrote: Are there any existing libs for the evaluation

Re: user math expression evaluation

2013-05-29 Thread Brian Craft
This looks useful. Is it tied to jvm? On Tuesday, May 28, 2013 6:21:30 PM UTC-7, Mikera wrote: On Wednesday, 29 May 2013 02:19:41 UTC+8, Brian Craft wrote: Are there any existing libs for the evaluation of math expressions? For example, if the user enters x + sin(y), parse and evaluate the

Re: user math expression evaluation

2013-05-29 Thread Mikera
The core.matrix API should be 100% pure Clojure. Some of the implementations are JVM specific however (e.g. support for fast operations on Java double arrays etc.) So... it probably needs a bit of hacking to make it work on ClojureScript with some form of conditional compilation setup. If

user math expression evaluation

2013-05-28 Thread Brian Craft
Are there any existing libs for the evaluation of math expressions? For example, if the user enters x + sin(y), parse and evaluate the expression, given vectors of floats for x and y. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to

Re: user math expression evaluation

2013-05-28 Thread Travis Vachon
Incanter has some stuff that does this: http://data-sorcery.org/2010/05/14/infix-math/ this looks even closer to what you're looking for: https://github.com/tristan/clojure-infix On Tue, May 28, 2013 at 2:19 PM, Brian Craft craft.br...@gmail.com wrote: Are there any existing libs for the

Re: user math expression evaluation

2013-05-28 Thread Brian Craft
Thanks, I'd seen those. Incanter is jvm only, I think, which is less useful to me. clojure-infix looks dead, but maybe I can adapt it. On Tuesday, May 28, 2013 12:42:11 PM UTC-7, travis vachon wrote: Incanter has some stuff that does this: http://data-sorcery.org/2010/05/14/infix-math/

Re: user math expression evaluation

2013-05-28 Thread SpiderPig
You could just write this yourself. It's easier than it looks. First start with an evaluator for rpn (reverse polish notation) expressions. x + sin(y) in rpn would be y sin x +. First you split that string and make it into a list. Then you can evaluate that with a few lines of code using a stack.

Re: user math expression evaluation

2013-05-28 Thread Jonathan Fischer Friberg
Found this: http://www.objecthunter.net/exp4j/ Might be useful. Jonathan On Wed, May 29, 2013 at 12:45 AM, SpiderPig spiderpi...@googlemail.comwrote: You could just write this yourself. It's easier than it looks. First start with an evaluator for rpn (reverse polish notation) expressions.

Re: user math expression evaluation

2013-05-28 Thread Mikera
On Wednesday, 29 May 2013 02:19:41 UTC+8, Brian Craft wrote: Are there any existing libs for the evaluation of math expressions? For example, if the user enters x + sin(y), parse and evaluate the expression, given vectors of floats for x and y. You can evaluate expressions like this right

Re: user math expression evaluation

2013-05-28 Thread SpiderPig
Here is some example code http://pastebin.com/HG2bWWms This allows you to evaluate infix or rpn expressions. It also demonstrates the use of eval to turn the expression into a clojure function which should give more performance. It is very simple though, so all the elements in the expressions