You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, while trying out MathLink.jl for Wolfram/Mathematica, I'm stuck on passing on arrays to be evaluated.
In Pluto;
a = 10;
weval(W`Sqrt[$a]`) gives right answer but if I do
a = collect(10:30)
weval(W`Sqrt[$a]`),
I get
Part::partd: Part specification Sqrt[[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]] is longer than depth of object. Part::partd: Part specification Sqrt[[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]] is longer than depth of object.
I tried different things, but stuck on how to proceed. Basically Mathematica/Wolfram Engine is looking for lists in the form {10,11,12,..} but $a passes [10,11,12..]
I'm finding MathLink.jl really neat but some sticking points exist.
Thanks!
The text was updated successfully, but these errors were encountered:
The problem with your approach is that $a is creating a table that will have valid julia syntax, whereas you want somethings that will have valid mathematica syntax.
The way around this is to use that MathLink can construct Mathematica functions the same way as Mathematica varaibles, using the W"<var>" command. There for try this code:
a = collect(10:30)
weval(W"Sqrt"(a))
Here the W"Sqrt" will handle the vector a = collect(10:30) correctly.
Hi, while trying out MathLink.jl for Wolfram/Mathematica, I'm stuck on passing on arrays to be evaluated.
In Pluto;
a = 10;
weval(W`Sqrt[$a]`) gives right answer but if I do
a = collect(10:30)
weval(W`Sqrt[$a]`),
I get
Part::partd: Part specification Sqrt[[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]] is longer than depth of object. Part::partd: Part specification Sqrt[[10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]] is longer than depth of object.
I tried different things, but stuck on how to proceed. Basically Mathematica/Wolfram Engine is looking for lists in the form {10,11,12,..} but $a passes [10,11,12..]
I'm finding MathLink.jl really neat but some sticking points exist.
Thanks!
The text was updated successfully, but these errors were encountered: