-
Notifications
You must be signed in to change notification settings - Fork 32
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
Conversion to julia expressions #16
Comments
We need some sort of way to match up functions between Julia and Mathematica. This is obvious in some cases (e.g. |
Is there a way we could query the signatures of the Mathematica functions, such that we could build a mapping via codegen? ( Check, if a method with a matching signature exists and if not, define a bridge ) |
Not that I know of. MathLink only sees symbol names, it has no semantic knowledge. This may be better handled in another package built on top of this. |
Even a version which doesn't translate function calls would be immensely useful |
https://github.com/AmplitudeGravity/usingMathLink/blob/master/useMathLink.ipynb uses https://github.com/chakravala/SyntaxTree.jl to do the very basics of this. |
Is it possible to convert a pure complex number in type of WExpr to a julia ComplexF64? |
I extracted part of @AmplitudeGravity's demo above and extended it in a package here: https://github.com/musoke/WolframExpr.jl. It converts Mathematica/Wolfram expressions to Julia expressions and functions. It only knows how to translate a handful of functions out of the box, but enough for complex rational functions. You can tell it how other functions are defined. julia> using MathLink, WolframExpr
julia> s = "(1 + G[x])/(1 + x + I*x^2)";
julia> f = string_to_function(s, [:G, :x]);
julia> g(x) = im * x + x^2;
julia> f(g, 1)
1.0 + 0.0im |
Hi, based on ticked (#72) I took the liberty to add the feature (`W2Julia ) in into the 0.5.3 release of today (https://github.com/JuliaInterop/MathLink.jl/releases/tag/v0.5.3). It aims to convert MathLink objects to Julia style objects. For instance it can convert the "Assumptions" to a dictionary. Below are some examples:
As this is almost at the embryo stage, feel free to report strange (or lacking) behavior i other tickets. |
Slightly late response, but I wrote a package called |
Being able to convert
WExpr
s to juliaExpr
, such that you can define julia functions, that you derived using Mathematica functions would be very nice to have.The text was updated successfully, but these errors were encountered: