SHARE
TWEET

mathematica

a guest Apr 23rd, 2012 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> from mathlink import *
  2. >>> import exceptions,sys, re, os
  3. >>> from types import ListType
  4. >>> mathematicaversion = "8.0"
  5. >>> os.environ["PATH"] = "/usr/local/Wolfram/Mathematica/" + mathematicaversion + ":/usr/local/bin:/usr/bin:/bin"
  6. >>> e = env()
  7. >>> sys.argv=['textfrontend.py', '-linkname', 'math -mathlink', '-linkmode', 'launch']
  8. >>> kernel = e.openargv(sys.argv)
  9. >>> kernel.connect()
  10. >>> kernel.ready()
  11. 0
  12. >>> kernel.putfunction("Prime",1)
  13. >>> kernel.putinteger(10)
  14. >>> kernel.flush()
  15. >>> kernel.ready()
  16. 0
  17. >>> kernel.nextpacket()
  18. 8
  19. >>> packetdescriptiondictionary[3]
  20. 'ReturnPacket'
  21. >>> kernel.getinteger()
  22. Traceback (most recent call last):
  23.   File "<stdin>", line 1, in <module>
  24. mathlink.error: MLGet out of sequence.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top