On 11/26/12 12:10 PM, ijt wrote:
Hello,
I was wondering if there is any way to make sage produce an output that I can
directly use in java code?
I am using sage to compute gradients and hessians of multidim. functions which
become quite large and replacing everything by hand is quite annoying.
For example, sage returns something like:
exp(x^2*log(z)-sqrt(y^5))
which in java code would look like
Math.exp(Math.pow(x,2)*Math.log(z)-Math.sqrt(Math.pow(y,5)))
This looks like fun!
http://interact.sagemath.org/node/76 (click evaluate)
That handles your example expression. The translate dictionary could be
expanded to handle lots of other cases as well, of course. Of note: the
sqrt function is actually a 1/2 power because that's how Sage represents
the square root.
Thanks,
Jason
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.