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 ...
PlatoManiac's user avatar
  • 14.6k
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 ...
Szabolcs's user avatar
  • 233k
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, ...
Itai Seggev's user avatar
13 votes

Controlling point in graphics 3D with locator

You can use ResourceFunction["Locator3D"] as follows: ...
Lukas Lang's user avatar
  • 33.5k
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: ...
Sjoerd Smit's user avatar
  • 21.9k
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 ...
wmora2's user avatar
  • 569
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 ...
Wolframlanguage Fan's user avatar
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: ...
Jason B.'s user avatar
  • 67.3k
11 votes
Accepted

How can I ignore an argument?

Using a default argument of 1: ...
Syed's user avatar
  • 42k
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's user avatar
  • 136k
10 votes

How can I ignore an argument?

Probably the easiest and clearest way would be to just overload mylist with another definition: ...
lericr's user avatar
  • 24.6k
10 votes
Accepted

Shading an area enclosed by a loop

maybe something like: ...
kglr's user avatar
  • 384k
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 ...
SquareOne's user avatar
  • 7,505
9 votes
Accepted

Electric Field Plot

...
Alex Trounev's user avatar
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
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 ...
david's user avatar
  • 1,290
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,...
Chris Degnen's user avatar
  • 30.8k
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 <...
Itai Seggev's user avatar
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.
Szabolcs's user avatar
  • 233k
8 votes

How can I ignore an argument?

While you didn't ask for advice, you could do this without the explicit While looping: ...
lericr's user avatar
  • 24.6k
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 ...
Szabolcs's user avatar
  • 233k
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: ...
LouisB's user avatar
  • 12.2k
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 ...
kglr's user avatar
  • 384k
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 ...
mikado's user avatar
  • 16.2k
7 votes

Polar Bubble Chart

Assuming that the data is formatted as {theta, r, size, temperature} ...
Bob Hanlon's user avatar
  • 152k
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 ...
thorimur's user avatar
  • 8,980
7 votes

How to find the repeated elements in a vector

DeleteCases requires a pattern, not a function, as second argument: ...
Roman's user avatar
  • 46.2k
7 votes

How can I ignore an argument?

Use Reap and Sow instead of AppendTo. Also you can do away with the ...
flinty's user avatar
  • 23.9k
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 ...
Itai Seggev's user avatar
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 ...
Jason B.'s user avatar
  • 67.3k

Only top scored, non community-wiki answers of a minimum length are eligible