-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile and evaluate separately #30
Comments
I have got this working now I think. It's a little strange but the equivalent of the above math.js workflow is:
|
Yep, that's exactly how to separate the compile and evaluate steps. If you
have suggestions for making it more natural, let us know.
…On Thu, Apr 16, 2020 at 7:03 AM markhats ***@***.***> wrote:
I have got this working now I think. It's a little strange but the
equivalent of the above math.js workflow is:
const expression = MathExpression.fromText(expr)
const evalFunc = expression.f()
const result = evalFunc([scope])
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH5GAEXGDUFJBGUQ3FCG7TRM3XX5ANCNFSM4MJM6TOA>
.
--
Duane Nykamp
School of Mathematics
University of Minnesota
202 Vincent Hall
206 Church St. SE
Minneapolis, MN 55455
www.math.umn.edu/~nykamp
|
I guess I was just expecting something similar to math.js, with separate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I may be wrong, but it looks like when you call
expression.evaluate({ x: 1 })
, it compiles it into a JS function every time before evaluating. Is it possible to compile the expression just once and then call evaluate many times on the compiled function, passing in different values forx
? This would make it much faster than compiling every time.The equivalent math.js workflow would be:
where the final
evaluate
could be called multiple times without recompiling.The text was updated successfully, but these errors were encountered: