37
votes
Accepted
Running Mathematica on Docker
Updated answer with Dockerfile
After the release of wolfram engine I thought it is a good time to revisit this old answer and refine it a bit.
First install docker on your machine. Follow docker ...
20
votes
Running Mathematica Notebook files in command mode
It is not a good idea to try to run a notebook in command line mode. Whether or not it is possible, it is just not a good idea because notebooks can only be handled by the Front End, which is not a ...
14
votes
Difference between "wolframscript -f" and "wolframscript -script"
The -script mode is an interface to the wolfram.exe's -script mode, which is a command-line version of Get. It essentially rewrites the command line, launches a kernel using the equivalent command, ...
13
votes
Controlling point in graphics 3D with locator
You can use ResourceFunction["Locator3D"] as follows:
...
12
votes
Accepted
How to determine the file type of a .m file?
It's somewhat of a meme that WL has a top-level function for everything, but it's kinda true:
...
12
votes
Controlling point in graphics 3D with locator
Well, I wrote an interactive Variable Calculus book and, as I don't know a "3D locator", I used mouse events to select and drag points. I learned the code from several posts. Here I share ...
11
votes
Running Mathematica on Docker
I created public resources to simplify and automate PlatoManiac's answer for you and all of us:
TLDR
https://account.wolfram.com/access/wolfram-engine/free?operatingSystem=LINUX
...
11
votes
What is an example of of idiomatic "typed" WolframScript?
Here is an idiom used by many built-in functions to achieve this effect:
...
11
votes
Accepted
10
votes
Accepted
TeXForm doesn't work in wolframscript?
I didn't check how formatting works in wolframscript but if you force it on your terms then it does not matter:
TL;DR: use:
$ wolframscript -cloud -code 'ToString @ TeXForm[ (d u)/(d t)]'

Kuba♦
- 136k
10
votes
How can I ignore an argument?
Probably the easiest and clearest way would be to just overload mylist with another definition:
...
10
votes
Accepted
9
votes
Accepted
Evaluating a notebook programmatically with -ne
Update
a very simple solution to the OP has been given in this very duplicate post: all the outputs (in particular graphics) are then correctly inserted in the evaluated notebook without the need to ...
9
votes
Accepted
9
votes
Installing WolframScript (12) on OSX (Catalina)
Download the latest WolframScript installer, which will work on macOS 10.14:
The installer from wolfram.com/wolframscript should work – ilian Oct 25 at 16:10
Community wiki
8
votes
Accepted
How to use woframscript (Mathematica 11) on Win 10 console command line?
After looking at my personal use license installation of Mathematica 11, I was able to get wolframscript to run by modifying the the configuration file at ...
8
votes
Running Mathematica Notebook files in command mode
To replicate the Ctrl+A Enter execution behaviour automatically you can run Solve.nb from a package file, say runSolve.m, containing the code below.
While Wolfram Language Scripts are straightforward,...
8
votes
Importing Packages to .wls without shadow definitions and context specification
Here's a version of the script that works:
#!/usr/bin/env wolframscript -print All -run \'Needs[\"ComputerArithmetic`\"]\'
Ulp[1000.]
This is a limitation of <...
8
votes
Accepted
why does wolframscript start an instance of Mathematica frontend?
Certain functionality, most notably rasterizing graphics, is implemented by the front end. In your case it is the JPEG export that triggers this.
8
votes
How can I ignore an argument?
While you didn't ask for advice, you could do this without the explicit While looping:
...
7
votes
NotebookEvaluate with InsertResults -> True from the command line
This is because the default format type is OutputForm when running on the command line. Add this to the beginning of your script to change it to ...
7
votes
Accepted
How do I get the script directory when running a wolfram script from the command line with wolframscript without -script in Mathematica 11?
Here is a WolframScript that prints its own file name and directory:
...
7
votes
Accepted
How to create a find-and-replace code in Mathematica?
You can use StringReplace to define a function to make the replacement and use FixedPointList to get the result of applying the ...
7
votes
Accepted
Destructuring a list containing two items to use it as arguments to a binary function
Here is one way to do what you ask
Through[{Mean@*List, Subtract}[1175., 247.]]
(* {711., 928.}*)
This works by using ...
7
votes
7
votes
Accepted
Stop a script. Just stop it
While you can always abort a running evaluation manually with Command + . (or Ctrl + .), here are several ways to do this in ...
7
votes
How to find the repeated elements in a vector
DeleteCases requires a pattern, not a function, as second argument:
...
7
votes
How can I ignore an argument?
Use Reap and Sow instead of AppendTo.
Also you can do away with the ...
6
votes
Accepted
How to recover WolframScript's former `-run` functionality?
This is an execution mode I don't think we encountered in internal testing for the new wolframscript, the thought being that such processing would occur early in the script, an any needed values would ...
6
votes
Accepted
How to export graphics to SVG in script executed through cron?
I can somewhat reproduce this error. Except for me, if I try to export a graphic with no display set, the kernel just hangs. The answer is to use an Xvfb display server, as described here.
I have ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scripting × 349command-line × 39
plotting × 19
front-end × 18
export × 18
kernel × 14
notebooks × 13
packages × 13
files-and-directories × 13
linux × 12
parallelization × 10
graphics × 9
free-wolfram-engine × 9
list-manipulation × 8
mathematical-optimization × 8
output-formatting × 8
mac-os-x × 8
external-calls × 8
import × 7
output × 7
windows × 7
differential-equations × 6
code-review × 6
wolfram-alpha-queries × 6
functions × 5