Skip to main content
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.8k
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
  • 235k
15 votes
Accepted

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
  • 14.2k
14 votes

Controlling point in graphics 3D with locator

You can use ResourceFunction["Locator3D"] as follows: ...
Lukas Lang's user avatar
  • 34.1k
14 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
  • 599
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
  • 23.7k
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
  • 68.7k
11 votes
Accepted

How can I ignore an argument?

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

Shading an area enclosed by a loop

maybe something like: ...
kglr's user avatar
  • 397k
9 votes
Accepted

Electric Field Plot

...
Alex Trounev's user avatar
  • 45.4k
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
9 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.8k
9 votes

How to find the repeated elements in a vector

DeleteCases requires a pattern, not a function, as second argument: ...
Roman's user avatar
  • 48.1k
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
8 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.6k
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
  • 14.2k
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
  • 235k
8 votes

How to find the repeated elements in a vector

You may use Tally and ConstantArray. With lst = {1, 2, 2, 1, 4, 3, 5, 5, 2, 7, 8, 9, 0, 11} ...
Edmund's user avatar
  • 42.3k
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
  • 29.2k
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
  • 235k
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
  • 397k
7 votes

Polar Bubble Chart

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

How to find the repeated elements in a vector

list = {1, 2, 2, 1, 4, 3, 5, 5, 2, 7, 8, 9, 0, 11}; Gather + Cases ...
kglr's user avatar
  • 397k
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
  • 25.5k
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
  • 14.2k

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