I've written some code in Mathematica, related to some group theory questions I have. Subsequently, I found that part of the code could be significantly sped up if I could just call a routine in Magma. Is there any way to have Mathematica ask Magma to run a subroutine, and then have Mathematica use the output?

More specifically, my Mathematica code outputs a bunch of relations, such as $a^2=b^2,ab=ca$. I need to then have Magma run the lines of code:


and then I need Mathematica to use the output $n$.

  • 1
    $\begingroup$ Can you add a minimal example to clarify what you want to do? This might make answering more efficient. $\endgroup$
    – Yves Klett
    Jan 8, 2016 at 9:25
  • $\begingroup$ Here's a component to use a similar package to magma called GAP: github.com/msollami/CodingBlog/blob/CodingBlog/GapLink.nb $\endgroup$
    – M.R.
    Jan 8, 2016 at 15:53
  • 4
    $\begingroup$ If you don't find a package that already communicates with Magma then you'll have to roll your own. The simplest way to communicate may be using StartProcess and related functions, if these work well with Magma and if Magma accepts piped input. The other option is to use MathLink to link them up. MathLink has official C, Java and .NET APIs. Doing this will be a lot of work (expect several days in the least), so I would definitely start with controlling the magma process using StartProcess. $\endgroup$
    – Szabolcs
    Jan 8, 2016 at 16:36
  • $\begingroup$ @M.R. Your link is dead now. Do you still have this? $\endgroup$
    – Szabolcs
    Jun 6, 2018 at 10:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.