Questions tagged [scripting]
For questions about Wolfram Language Scripts (formerly known as Mathematica Script), or running the kernel without direct user interaction.
372 questions
0
votes
0
answers
54
views
Get file directory, whether notebook or script
I have some code, currently in a notebook, which should produce some output in the same directory as the notebook, for which I am using NotebookDirectory[]. I would ...
0
votes
0
answers
72
views
Robust way to test whether two symbolic expressions equals in python interface of Wolfram script
I have two mathematically equivalent latex strings
...
4
votes
1
answer
206
views
What does the wolfram lint "SuspiciousSessionSymbol" issue mean, and what's the best way to resolve it?
I have a script that I run from a .wl file which I sometimes run from a notebook and sometimes call using wolframscript -file. I ...
3
votes
1
answer
88
views
Unexpected changes of $InputFileName after using SetDirectory
I have stumbled upon a very strange interaction of the system variable $InputFileName when using SetDirectory and ...
2
votes
0
answers
108
views
How would one edit an individual datum in a Tabular object in Mathematica?
In Excel, for example, or even in R, one can directly edit the cells in a tabular array.
With the new Tabular object in Mathematica, is that possible, or is one compelled to write out a script?
1
vote
0
answers
33
views
Multiple Mathematica Scripts through ssh connection
I am trying to run 8 Mathematica Scripts on a HPC that I access through ssh. I wrote this script:
...
3
votes
1
answer
198
views
Why is the execution of a wolfram script `.wl` is slower in linux than in a macos?
I have a wolfram script that does the following tasks in the following sequence:
import 2 csv data files
make bunch of plots
save 4 PDF files of plots
I have licensed ...
0
votes
0
answers
353
views
Best way to run Mathematica code from visual studio code?
Is there a way to run Mathematica code in Visual Studio Code that is similar to Python? For example, one can create a Python file called test.py in VS Code and run ...
0
votes
0
answers
102
views
Properties of conjugate transpose
I need to define the properties of conjugate transpose in mathematica:
Properties of Conjugate Transpose:
...
0
votes
1
answer
168
views
How to run Wolfram kernel from under Windows service to export charts
I want to generate multiple charts using Wolfram as a chart generator. To do so I generate an input file, e.g.. example.m:
...
0
votes
0
answers
94
views
3
votes
2
answers
186
views
7
votes
2
answers
169
views
Detecting and converting a number from a video (digital panel) into an actual number
Let's say I have video (mp4) of length 02:17:38 (hh:mm:ss), this video is a record of a temperature panel, as shown in the following image. How can I use mathematica to extract the temperature, given ...
2
votes
0
answers
95
views
Evaluation break in WolframScript
Astonishingly, I couldn't find this either by googling or tag search here.
CTRL-C completely closes WolframScript (on my Windows 10). But I just want to break the evaluation (if it takes too long). ...
0
votes
1
answer
176
views
Splitting an audio into multiple segments based on the pauses
I am not an expert in mathematica, I wanted to Split an audio into multiple segments based on the pauses. I asked AI if that is possible, it said: "it is possible". It provided me a code for ...
1
vote
1
answer
220
views
2D momentum type equation for compressible fluids
I have this program which displays errors in the declaration of terms, I've tried to modify it several times but it displays the same errors, apparently in the declaration of the term $(v \cdot \nabla)...
4
votes
1
answer
151
views
Changing line breaks in WolframScript
Is there any command parameter for WolframScript that changes after how many characteres a continuation line is inserted? For example, using // MatrixForm output ...
1
vote
1
answer
261
views
Shadow contour and parametric plot with mathematica
I am trying to find black hole shadow contour with respect to temperature. with metricf[r_] := -((2*M*r^2)/(g^3 + r^3)) + (8/3)*Pi*P*r^2 + 1. So here is my code,
<...
3
votes
4
answers
237
views
Sort Column as a Row
I have
a = {1, 2, 3, 10};
b= {2, 3, 4, 8};
t= Do[If[a[[i]]+b[[i]]>3,Print[a[[i]]],"No"],{i,1,4}];
2
3
10
I need to get the result; t={2,3,10}
4
votes
1
answer
274
views
Is the WolframScript error message "The product exited because of a license error" accurate? [closed]
I find that sometimes when I use wolframscript to run a .wls file
(as part of a workflow involving hundreds of such files),
its ...
4
votes
1
answer
257
views
Formulate and solve a system of linear, first-order ODEs in Mathematica
I know this code is wrong, but I am not sure why. I have a system of coupled differential equations. The model is given by the following equations:
$\frac{dS_0} {dt} = (1 - \mu_0) \rho_0 S_0 \frac{S_\...
2
votes
1
answer
190
views
Consumer Maximization Problem Doesn't Work in Wolfram Mathematica
I'm trying to solve a problem that can be seen in the paper "The Role of the Structural Transformation in Aggregate Productivity". The problem is:
Manually it is difficult to find the ...
1
vote
1
answer
122
views
Insert a nonlinear PDE in Mathematica
I am new to Mathematica and trying to learn its language.
I want to solve a non-linear PDE but don't know how to insert it.
Would you please help me or give me some tutorial about it?
3
votes
1
answer
203
views
Is it possible to speed up loading time of Mathematica script?
Even a simple
#!/usr/bin/env wolframscript
(* ::Package:: *)
Print[1]
takes 3 seconds to finish on my computer.
Can Mathematica script load only what it needs for ...
1
vote
0
answers
93
views
Export data vertically
I have data that I want to export to a text file.
...
2
votes
0
answers
61
views
File formats of the Wolfram language [duplicate]
I am new user of Wolfram language and Wolfram Mathematica. And want to understand differences and purpose between file formats of ".m", ".wl" and ".wls". I have read ...
0
votes
0
answers
55
views
How Do I Graph an SVEIAR function with the reproduction Number
Just need help figuring out how to plot a graph of an SVEIAR model with its' reproduction number. I'm a bit confused on how to properly make a graph based off the model and reproduction number.
...
0
votes
0
answers
69
views
I need help with plotting and SVEIAR Code with the Reproduction Number on Mathematica
I need help because everytime I plot it doesn't work.
...
3
votes
3
answers
531
views
Converting Wolfram Language Scripts (.wls) into PDFs
I have just discovered the free (as in free beer) Wolfram Engine, coming with a generous licence. After playing with Mathematica for a while, and missing the notebook feature, I would like to generate ...
3
votes
2
answers
426
views
Importing a text file of values and converting it to table
I just started using Mathematica. I got some output in a txt file from some computations in Pari/GP which looks like this:
$$ [1,2,3,4; 5,6,7,8]$$
Here I want to import the data into Mathematica and ...
0
votes
0
answers
53
views
How to solve unexpected behaviour with function calls in wolframscript?
I have the following piece of code saved as script.wls that is called using wolframscript -file script.wls <inputs>
...
0
votes
0
answers
151
views
How to pass variables from Python to Mathematica?
I have a Mathematica code that I want to run via Python using subprocess. The Mathematica code contains two variables that I want to pass through Python.
However, when I tried to do that, I always got ...
5
votes
0
answers
133
views
What is the most convenient way to organize dependencies from paclets?
Do you have any ideas on how to most conveniently and easily organize package dependencies for Wolfram Language projects. I would like to have something like a list of packages in projects for .Net ...
2
votes
1
answer
1k
views
Wolframscript kernel in Visual Studio Code
I installed the free Wolfram Script and Wolfram Engine on my Mac (I do not have Mathematica), and I generated free activation keys. After entering these keys into the terminal, I am able to run ...
-1
votes
1
answer
128
views
Finding the dimensions of the cylinder that can cover $n$ given smaller cylinders (based on empty space, not least materials)
Let $r_k$ and $h_k$ be, respectively, the radius and the height of the $k^\text{th}$ cylinder. We have $n$ cylinders.
Let $R$ and $H$ be, respectively, the radius and the height of the big that can ...
1
vote
1
answer
358
views
Can I use WolframScript to solve this system of equations?
I have these three equations:
...
0
votes
1
answer
260
views
Is there a way to make WolframScript give outputs as a single line?
When the output of a calculation includes exponents or fractions, WolframScript is writing them out on separate lines (exponents one line above, then a line with the rest of the numerator, then a line ...
1
vote
1
answer
120
views
Way to stop reading script file based on conditions, without an "if" block wrapping the entire file
I have a bunch of definitions written in a file that I load with Get["..."], . I would like add a line into the the file so that the evaluation of these ...
1
vote
0
answers
119
views
Plotting equipotentials line of a Julia set in Mathematica
I need to plot the equipotential lines of the Julia sets of the polynomial $f(x)=x^2-1$ by using Mathematica, but I don't have a good background in programming.
Given $f$, with equipotential lines I ...
6
votes
2
answers
249
views
Passing negative parameters to a wolframscript
How do you pass negative values as input for a wolframscript?
This documentation page explains that the syntax for passing parameters is:
...
0
votes
0
answers
69
views
Data Export not working when running module using Wolframscript compared to executing in notebook
I have a Mathematica module im_solver.m that I wish to iterate through Python or a bash script. The module runs a bunch o' other modules. At the end im_solver.m executes a diagnostic.m that collects ...
3
votes
2
answers
230
views
Entering matrices interactively
I am looking for a way to enter an m*n matrix interactively using a dialog or a Graphical User Interface(GUI). Further, I would like to use this matrix later for ...
0
votes
0
answers
505
views
Correct way to plot with wolframscript
I am trying to run a .m file with wolfram script. I use the command
wolframscript -file name.m
It works until the program arrives to a ...
2
votes
1
answer
199
views
WSL/Ubuntu breaks evaluation of WolframScript batch file via symbolic link
I have a very useful bash script for pre-processing a Mathematica notebook before committing it to my local git repo. It works fine under Windows/Cygwin and under Linux. I like to keep one master copy ...
5
votes
5
answers
2k
views
How can I ignore an argument?
I made some code (attached below). It is meant to make a list of random numbers that is not divisible by some value k.
I wish to be able to not enter a value k, and have the code run regardless. It ...
3
votes
3
answers
552
views
How to make a function take another function as an input?
I am quite new to mathematica, and I simply want to know how to make a custom function, take another arbitrary function as an input.
I have attached code that shows what I am trying to accomplish (...
4
votes
6
answers
242
views
How to make an element in a list nested within a list have a default value?
I would like to be able to skip the necessity of entering the last element in the nested lists, and get some default value instead if they are not entered.
Below are two lines of code. The first line ...
1
vote
2
answers
370
views
2
votes
0
answers
178
views
How to run Mathematica from a bash script file? [closed]
I would like to run a Mathematica package math-simple.m file inside of a bash script file. Howeever, when I write inside of the bash script as:
math -noprompt -script math-simple.m
I get a warning as /...
0
votes
0
answers
150
views
How can I retain an old version of wolframscript during an upgrade?
During the process of upgrading Mathematica to a newer version, we are presented with the choice of retaining or uninstalling an older version. But it seems that this choice does not extend to ...