Questions tagged [scripting]

For questions about Wolfram Language Scripts (formerly known as Mathematica Script), or running the kernel without direct user interaction.

Filter by
Sorted by
Tagged with
5
votes
1answer
157 views

How to run wolfram code from the finder in macos?

I'd like to run wolfram code (probably a .wls script) on a file or set of files by selecting them in the finder and using Right-click > Services. For example, ...
0
votes
1answer
51 views

Quit Mathematica script (no matter what)

I have a complicated script (not just written by me) that gets called using MathKernel -script script.m. Among others script.m ...
2
votes
0answers
45 views

Where does wolfram script store the command history? (like .bashrc)

I'm imagining there is a file like bashrc, because I've noticed the wolfram Script on windows remembers my command history. I'm using ...
6
votes
3answers
316 views

How to rotate a circle around the y-axis and calculate the volume of the 3D solid?

How do I rotate the equation ${(x-5)^2}+{y^2}={3^2}$ around the y-axis and calculate the volume of the plotted 3D solid? I tried the code below but the result doesn't work. ...
0
votes
0answers
28 views

Keep Mathematica kernel for a script alive without having to initialize every time (Windows 10 .bat file)

I have a Mathematica script (ChristMetric.wls) that is plugged in to a python code which exports a list of geometrical data in .txt file. I plugged the script into the python by making a .bat file in ...
0
votes
0answers
43 views

Running the wolframscript on linux then it returns permission denied

I use the script from mathematica's tutorial ...
2
votes
1answer
108 views

How can I combine two parametric plots in a continuous one?

I'm studying the Ekman spiral for piecewise uniform viscosity. So I have two velocity components (u,v) for every layer. One pair for the sufrace and one pair for the layer below. ...
4
votes
1answer
92 views

Asymptotic[] Doesn't Actually Compute

I ran into this problem while studying the asymptotic behavior of a probability distribution function called tao2. It computes correctly at positive infinity but doesn't actually compute at negative ...
0
votes
1answer
58 views

Defining elements of matrix as a function of two variables (the position $(i,j)$ ) [closed]

I have the following array, which generated from grayscale image data,: $$ \left( \begin{array}{cccccccc} 162 & 162 & 162 & 161 & 162 & 157 & 163 & 161 \\ 162 & 162 &...
0
votes
1answer
68 views

My plotting comes out to be gray not coloured using AbsArgPlot function in Mathematica. What is the reason for not getting a coloured graph??h

My graph comes out to be gray, not coloured using AbsArgPlot function in Mathematica. What is the reason for not getting a coloured graph or what I can deduce from ...
1
vote
1answer
48 views

How to initiate a matrix with indexed parameters [closed]

I couldn't find it in the documentation, so I'm posting it here. I want to create two by two matrices as follows: $$ `W = \begin{bmatrix}w_{11} & w_{12} \\ w_{21} & w_{22} \end{bmatrix}, V = \...
2
votes
0answers
36 views

UnityLink called from wolframscript seems to work, but

I've tried to use UnityLink with Mathematica 12.1.1 on OS X 10.15.7. I found that code running ok in Mathematica FrontEnd does not run correctly if used in wolframscript. When exporting the notebook ...
0
votes
1answer
33 views

How can I pass a string variable to script.m which I run with math -script script.m? [closed]

I am not a very experienced programer, so this question might be trivial. I have a program which should run multiple mathematica scripts. There I need to pass some string variable, say "A" ...
4
votes
4answers
121 views

How to find the repeated elements in a vector

Is there a way to write a function where the input is a vector and the output is the elements in the vector that are repeated? I was trying to use something along the lines: ...
4
votes
1answer
58 views

is it possible to stop/kill Mathematica Frontend from wolframscript?

I use wolframscript to generate hundreds of images like this visualization of 4fold symmetry of octahedron (to be combined in animation videos) like so: ...
1
vote
1answer
35 views

Logarithmic steps inside a Do

I have trouble, i need to do several computations inside a loop using values in a logaritmic scale, is this possible? Inside of the cicle i create a several data sctructures, and it currently works ...
0
votes
0answers
32 views

Handling large data generated by a script file (using parallelization in Mathematica)

I want to write a script file Script_file.m which I am going to run on a server and collect all the data in a file named ...
2
votes
1answer
48 views

Make different Mathematica notebooks stop talking to each other [duplicate]

So basically I am working in two completely different notebooks. But, if I define something in one notebook, it will overwrite the same definition in my other document. Somehow these files talk to ...
3
votes
1answer
111 views

Stop a script. Just stop it

How can I stop a mathematica script? Abort[] does not stop the script, just jump over a number of lines and proceed with next lines of calculations. Also, killing ...
0
votes
0answers
21 views

MathKernel vs wolframscript and passing parameters from the command line

I have a script that works perfectly well when invoked with MathKernel -script. However I would like to pass it arguments. I can do this using ...
2
votes
0answers
47 views

Running a Mathematica script passing parameters from within another Mathematica file

What is the recommended way to run a Mathematica file file_loaded.m from another Mathematica file main_file.m passing an ...
2
votes
0answers
70 views

Help with script for running AceGen generated routine in ABAQUS

I am using the below configuration to run a AceGen-generated viscoelastic element in Abaqus. Abaqus version: ABAQUS 6.14-6, OS: Windows 10, Visual studio: 2013, Fortan compiler: Intel Fortran compiler ...
4
votes
1answer
99 views

How to determine the file type of a .m file?

Both Mathematica and MATLAB widely uses .m files, but with diametrically different syntaxes and usage. Currently WRI is moving towards the ...
16
votes
1answer
197 views

How to create a CLI for Wolfram language scripts?

Former question: How to use wolframscript to develop flexible command-line tools? I am currently changing a notebook into a wolframscript for a "production" environment, where I plan to ...
1
vote
2answers
80 views

Import all files in folder, perform operation, re-export with appended file name

I'm trying to write a short program that does the following over and over again. Import all files in a folder Automatically generate names for the imported files based on source file name. Perform a ...
4
votes
1answer
125 views

why does wolframscript start an instance of Mathematica frontend?

The following wls file surprisingly creates an instance of Mathematica (v12.1) on OS X 10.15.7: ...
1
vote
1answer
67 views

Wolfram script produces no output

I use Mathematica to create a series of PNG images in a for loop. I want to execute the notebook from the command line in macOS. I exported it as a wolframscript -- see below -- but nothing happens ...
2
votes
1answer
67 views

Copying Weights using NetTrain in Mathematica

I would like to implement the PPO algorithm - Reinforcement Learning - in Mathematica. And for that, I need to be able to copy network weights from say subnetwork NN1 to subnetwork NN2 as an update ...
1
vote
1answer
33 views

Reading specific data from files

I have a huge number of identically formatted .txt files. I would like to read some numbers at a specific position within the text file (row x, column y..) and put them in another file, then repeat ...
1
vote
0answers
29 views

Problem in redirecting output from wolframscript

I am having a very strange problem in scripting with wolframscript. As a MWE I have a .wls which prints its command line argument. I launch several of these scripts with a bash script, each ...
0
votes
2answers
101 views

Better method for computing streamlines

Can someone suggest a better way to solve for streamlines? P.S. StreamPlot is not providing accurate results. Here, velocity is...
1
vote
0answers
15 views

Initializing section header doesn't mark sub cells as initialization cell

I have some definitions organised into Chapter>Section>subsections etc in a notebook. I wish to run this code in wolframscript so I tried (following advise from various question on SE) exporting ...
1
vote
1answer
68 views

How to change the RandomReals each iteration

I am intending to use NestWhile in finding a solution with random real values as parameter. ...
2
votes
0answers
63 views

How to read input stream with no newlines?

I have a script named stdout.wl: ...
0
votes
0answers
26 views

numpad not working in wolframscript

I am not sure if this question is suitable here, if so please migrate or guide. I just installed wolframscript.exe via a WolframEngine installation. After launching ...
1
vote
0answers
127 views

WolframKernel not found when running WolframScript

While attempting to run wolframscript in linux, I get the error "WolframKernel not found. Use -configure to set WOLFRAMSCRIPT_KERNELPATH Or export WolframKernel=/yourpath/WolframKernel" I am ...
0
votes
0answers
130 views

WolframKernelException: Failed to communicate with kernel

I am an absolute beginner of Mathematica!! .. I have downloaded, installed and activated the wolfram engine (12.1) on Windows. I have installed the WolframClient and kernal location is in kernelLoc = '...
3
votes
3answers
259 views

Polar Bubble Chart

I would like to create a plot similar to that in the figure 1. I tried using both ListPolarPlot and BubbleChart, but they do not have the right option for creating a polar bubble chart. Any suggestion?...
5
votes
1answer
130 views

Rendering graphics: UsingFrontEnd vs using a front end

I'm trying to understand how Graphics expressions are rendered. I create an invisible notebook, write a cell and evaluate it, then rasterize the notebook. ...
0
votes
0answers
68 views

Question about Clear function

I have a script starting with Clear ["r*", "data*", "file*"]. Does this clear all variables starting with "r" or "data"or "file"? Also, I ...
1
vote
3answers
44 views

Variable depth of nesting inside Table [closed]

I need to create a table where there are variable number of iterators. something like Table[s_1 *s_2 *... s_n,{s_1,1,5},{s_2,1,5},....,{s_n,1,5}] where n is a ...
1
vote
0answers
40 views

How to retrieve the original mathematical expressions from some sort of scripts?

I quit my Mathematica notebook session mid-computation. When I reopen it, the mathematical expression disappeared leaving something like ...
2
votes
1answer
38 views

wolframscript output differs when code is stored in a file

I noticed that the output from wolframscript appears to be different when running interactively and when running with code in a file. I tried searching for this, ...
1
vote
1answer
54 views

How to calculate the variation of curvature along the horizontal axis

I have a data set with $(x,y)$ coordinates. I do the following to import the data ...
0
votes
0answers
73 views

Is it possible to generate and export plots in a high-performance cluster environment?

I have access to a cluster that uses SLURM. I am not very knowledgeable about using clusters, so figuring out how to submit Mathematica jobs was a challenge but eventually something was worked out. ...
2
votes
0answers
99 views

How to use Mathematica code in LaTeX files?

How can you use Mathematica code in LaTeX files? any similar to A random number is RNUMBER and the square of RNUMBER is RNUMBER^2 appearing numbers instead the capital letters (or Mathematica code) ...
7
votes
0answers
249 views

How to properly call Wolframscript from Python?

I am using Windows 10 x64. If I run the following code in Command Prompt: wolframscript -code ToString[TeXForm["Integrate[Tan[x],x]"]] I get the following ...
3
votes
1answer
131 views

Entering natural language input in WolframScript

What is the equivalent of typing = at the beginning of a line to specify natural language input in WolframScript?
7
votes
1answer
539 views

Difference between math and wolframscript

It seems that both math and wolframscript can be used to run Mathematica scripts on the ...
1
vote
0answers
49 views

Running mathematica from terminal

I was looking information about how to run a mathematical script from shell in a remote cluster. Normally, I used this command: math <file.m> file.out& ...

1
2 3 4 5 6