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 ...
- 14.5k
23
votes
math.exe vs wolfram.exe vs MathKernel.exe vs WolframKernel.exe (running scripts on Windows)
These two small programs -- math.exe is the same as wolfram.exe, and MathKernel.exe is the ...
- 25.3k
17
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 ...
- 231k
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.9k
13
votes
Accepted
Can't run Bash scripts from within Mathematica 10.1
(Reposting my comment as an answer)
The reason this is happening is that the Mathematica launcher script sets LD_LIBRARY_PATH so that libraries included in the ...
- 25.3k
13
votes
Controlling point in graphics 3D with locator
You can use ResourceFunction["Locator3D"] as follows:
...
- 30.2k
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:
...
- 20.1k
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 ...
- 559
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:
...
- 65.8k
11
votes
Accepted
10
votes
Accepted
Windows command line arguments, stdin & stdout
On Windows, MathKernel.exe launches the kernel running within a window. The standard output is redirected to that window. To avoid this redirection, we must run the kernel as a console application ...
- 67.9k
10
votes
How can I ignore an argument?
Probably the easiest and clearest way would be to just overload mylist with another definition:
...
- 15.5k
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 ...
- 7,400
9
votes
Accepted
9
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♦
- 135k
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
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,...
- 30.4k
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 <...
- 13.9k
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.
- 231k
8
votes
How can I ignore an argument?
While you didn't ask for advice, you could do this without the explicit While looping:
...
- 15.5k
7
votes
Analogue of NotebookDirectory[] for scripts (to get the directory path of my script.m)?
DirectoryName @ $InputFileName
is the answer, right?
And this will work whether you call it from a package or a notebook interface:
...
Kuba♦
- 135k
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 ...
- 231k
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:
...
- 11.9k
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 ...
- 356k
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 ...
- 15.8k
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 ...
- 8,695
7
votes
How to find the repeated elements in a vector
DeleteCases requires a pattern, not a function, as second argument:
...
- 41.2k
7
votes
How can I ignore an argument?
Use Reap and Sow instead of AppendTo.
Also you can do away with the ...
- 22k
6
votes
Accepted
Run mathematica scripts without initializing the kernel every time
This works for running scripts. Print is not supported although the last return value defaults to the stdout.
...
- 7,511
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
scripting × 333command-line × 38
front-end × 18
plotting × 17
export × 17
kernel × 14
notebooks × 13
files-and-directories × 13
packages × 12
linux × 12
parallelization × 10
graphics × 9
list-manipulation × 8
mac-os-x × 8
external-calls × 8
output-formatting × 7
output × 7
windows × 7
mathematical-optimization × 6
code-review × 6
wolfram-alpha-queries × 6
free-wolfram-engine × 6
differential-equations × 5
functions × 5
bugs × 5