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 now in core.matrix if you don't mind Lisp notation: (use 'clojure.core.matrix) (use 'clojure.core.matrix.operators) ;; override +, -, == etc. (def x [1 2 3 4 5 6 7]) (def y [0 1 2 3 4 5 6]) (+ x (sin y)) => [1.0 2.8414709848078967 3.909297426825682 4.141120008059867 4.243197504692072 5.041075725336862 6.720584501801074] To enable this to handle regular infix maths expressions, it should be fairly easy to layer an Instaparse parser on top of this. Also, one of our newly accepted GSoC students (Maik Schünemann) is looking at a library for expressing, manipulating and evaluating symbolic maths expressions. Some initial experiments here: https://github.com/clojure-numerics/expresso Once this is complete, it should be possible to simply such expressions, compute symbolic derivatives etc. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.