1
$\begingroup$

Running Mathematica 10 on Ubuntu 14.04. When I run the following in the notebook it shows a plot. When I run the same code from a script (math < plot3d.test.m) there is no graphical output. The command line shows

Out[2]= -Graphics3D-

Code

fxy = -(Cos[x]^2 + Cos[y]^2)^2;
Plot3D[fxy, {x, -90, 90}, {y, -90, 90}]

I'm using an evaluation version. Is this perhaps a limitation of the evaluation version?

Thanks.

$\endgroup$
4
  • 1
    $\begingroup$ No, it is not a limitation. In script mode (which you should invoke using -script option, see here) there is no front end, which is required if you want graphical output. In commandline-mode you can use JavaGraphics to display your plot, but when you run it as script, the window is closed immediately. $\endgroup$
    – halirutan
    Commented Oct 14, 2014 at 3:52
  • $\begingroup$ When I run with math -script somefile.m I don't get any output. The math -script option is useless when you need to see output. The link you've included is vague. What is the right way to run a Mathematica script when you need to see output? $\endgroup$ Commented Oct 14, 2014 at 14:13
  • $\begingroup$ If the JavaGraphics window closes immediately when run from a script it's useless. Is the Notebook the only way to get graphics? $\endgroup$ Commented Oct 14, 2014 at 14:34
  • 1
    $\begingroup$ Let me make it more clear: There are different forms of output. When you want to print something to the console, then a terminal session of Mathematica, a redirect of a file into math or the -script mode will work. If you need to show a graphics, then this will not work, because you need a front end for this. When you run something as a script, then there is usually no need to display a graphics, because you want to automate some work or/and run several file in batch-mode. Can you please add more information about what you try to achieve? $\endgroup$
    – halirutan
    Commented Oct 14, 2014 at 14:36

0

Your Answer

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

Browse other questions tagged or ask your own question.