0

I am using WSTP to connect to Mathematica and get my computation tasks performed via WSTP Link. This connection is initiated with WSOpenArgcArgv. It looks like I am using a command line based Mathematica frontend while invoking Mathematica commands. Can I execute an expression to another Mathematica GUI Window, which is open in the same computer ? May be using CreateLink ?

Neel Basu
  • 961
  • 6
  • 14
  • It's not fully clear what you are asking. What does it mean to "execute an expression to another Mathematica GUI Window"? What are you trying to achieve, in practical terms? – Szabolcs Oct 23 '17 at 19:10
  • I have built a frontend for my simulation. Now I want Mathematica to compute and return me the output. Till this it works fine with WSTP. But now I want Mathematica generated 2D and 3D Plots. For this I can export Mathematica returned expressions as an image or 3ds graphics and render that in my application. But for that I need to write a good viewer, and I am too lazy for that. So I want a Manipulate, Plot or Graphics3d or Wolfarm Alpha command to be executed to another Mathematica window which is open in the same computer. Better if I can talk to that frontend via TCP socket – Neel Basu Oct 24 '17 at 19:56
  • Sorry, I still do not follow. Also, if you merely have a simulation that needs to be accessible from Mathematica, I do not understand why you are not using an installable MathLink program (i.e. why you are not calling C from Mathematica rather than Mathematica from C) – Szabolcs Oct 25 '17 at 11:57
  • Because I need some initial GUI controls to shape the inputs and I need some other GUI controls to work on intermediate data. It is easier to work with those GUI controls in C++. – Neel Basu Oct 25 '17 at 12:14
  • Also Manipulate doesn't give enough flexibility of GUI controls, that I can achieve from an external C++ GUI (which is talking to Mathematica over WSTP) – Neel Basu Oct 25 '17 at 12:21
  • I'm a little bit confused why you're even using Mathematica in this case. Given what you've told @Szabolcs, you seem to only want its 3D plotting abilities. It's probably easiest to just use a C++ 3D plotting library, since you seem to have all the other front-end stuff down. That said, I think this is an interesting question in general and would like to see an answer to it. – b3m2a1 Oct 25 '17 at 18:17
  • I am doing some analysis in frequency domain, solving some reccurence relations, and then doing some optimization based on that analysis. Output of that optimization is used to take certain actions on a set of resources (which I do in C++). Also as the input is in a complicated hierarchical shape I use C++ based GUI to shape that. I know I can do all computations in C/C++ or in any Turing compatible language. But I choose to do the computation part in Mathematica instead. But I need intermediate visuaizations for my references. I know that I can create a viewer, but I don't have enough time. – Neel Basu Oct 25 '17 at 18:34
  • I understand what I am trying to do is kind of luxury, because there are other way out (which are not that good). Like creating a cdf which have all the visualizaions packed inside it. But this is my backup plan. And this is how I have solved the problem for now. But I would love to see if I can send some command to another Mathematica GUI frontend. If that works I would say that is my visualisation window, just like people use a debug window, or logging window. – Neel Basu Oct 25 '17 at 18:53
  • I have no experience with such links but this answer seems to be something you could use: https://mathematica.stackexchange.com/a/138433/5478 – Kuba Oct 27 '17 at 07:18

0 Answers0