Questions tagged [scripting]
For questions about Wolfram Language Scripts (formerly known as Mathematica Script), or running the kernel without direct user interaction.
347
questions
3
votes
2
answers
166
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
26
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
57
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 ...
0
votes
0
answers
24
views
How to insert/type the square brackets in Wolfram Engine/script window?
(Win10 with spanish QWERTY keyboard, using Fn key to obtain []. Wolfram Engine/script 13.3 or previous)
I can type the square brackets (curly braces / parentheses, curly brackets) in the "System ...
0
votes
0
answers
54
views
Plot the resolvent operator function of a second order differential operator
I would like to plot the resolvent operator function of the following second order differential operator in $ L^1(0,+\infty)$, given by: $$(A) f(t)= \varepsilon f''(t) + b(t)f'(t)+c(t)f(t), \quad t\in ...
4
votes
0
answers
53
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
275
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
72
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 ...
0
votes
1
answer
154
views
Can I use WolframScript to solve this system of equations?
I have these three equations:
...
0
votes
1
answer
82
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 ...
0
votes
1
answer
62
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
68
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
177
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
36
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
1
answer
189
views
Shading an area enclosed by a loop
I am plotting the folium of Descartes as a parametric plot, and trying to find the arclength and the area enclosed by the loop. I got both of them covered result-wise, but my professor wants us to ...
3
votes
2
answers
146
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
131
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
107
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
417
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 (...
2
votes
3
answers
107
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
177
views
1
vote
0
answers
94
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
78
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 ...
3
votes
1
answer
55
views
How to force standard output as FortranForm while calling a script from terminal
Here's a simple script saved in the file fortranOutput.wls
x = ToExpression[$ScriptCommandLine[[2]]]
d=FortranForm[x]
Print[d]
When I call this function from the ...
0
votes
0
answers
58
views
Can Mathematica automatically submit a code for evaluation every 10 seconds?
I would like to automatize Mathematica to run the code:
[Geolocation]
every ten seconds. Is that possible?
I have searched online, but could not find any ...
1
vote
2
answers
234
views
Can we solve the following integral by MATHEMATICA?
I am trying to solve the integral using the following Mathematica code.
f1 = (t[m + 1] - t)^(\[Alpha] - 1)*(t - t[m - 1])*(t - t[m - 2]);
...
2
votes
3
answers
116
views
Removing lists containing some rules
Consider a big list of lists of rules, namely
...
4
votes
1
answer
86
views
Graphing the equation only after the right answer is picked
I need the equation in the question to be graphed only after the right answer is picked
I'm using this form to write questions :
...
1
vote
0
answers
54
views
how to add questions with grades
I want to add questions with grades,
I'm using this form to write questions :
...
0
votes
1
answer
55
views
Getting 3 points although the code describes 1 point in the plane
I'm trying to plot the closest point in the plane to the point P (the one that can be dragged) but in the graph appears 3 points.
in the graph I'm plotting a plane and a point P, I want to add another ...
9
votes
2
answers
183
views
Controlling point in graphics 3D with locator
I want to control a point in 3D graph by dragging it with the mouse
lets say this is my code and I want to add some functionality like the way locator works in 2d graphics
...
0
votes
1
answer
115
views
Error : Array {-6, 2} has the wrong dimensions for a graphics coordinate list [closed]
I'm trying to plot two lines and the point of intersection between them,
and I got this error :
...
3
votes
2
answers
97
views
How to change the manipulation of the point Q to a Locator?
I want to control the point Q by a Locator not with Slider, how to make this work?
...
0
votes
0
answers
92
views
Multiple 2D and 3D plots in a table with mathematica/wolfram
I'm a mathematica newbie!
I want to display 15 plots (5 rows labeled by "A" "B" "C" "D" "E" and 3 columns labeled by "P1" "P2" &...
1
vote
0
answers
158
views
What are the limitations of using Wolfram cloud?
I have a program which requires more than 2 hours of running on my computer. I tried to use Wolfram cloud to run the script, but after few lines on evaluation and reaching the time consuming part, the ...
1
vote
1
answer
77
views
Wolframscript: Removing prepended message from Print in slave kernel
I am running a parallelized algorithm using WolframScript and inside the function being passed to the various kernels, I have print statements that track the computation and output the print ...
0
votes
0
answers
61
views
Pass parameters to notebook being opened?
Is there a way to pass a parameter to a notebook which is being programmatically opened?
For example, I would like to be able to pass a parameter to myNotebook.nb
...
1
vote
1
answer
90
views
Execute script in text mode and keep interpreter open
I'm on linux using Mathematica 12.1.1 in text mode, i.e. command line.
How do I execute a script (which for me just means a text file with valid Mathematica expressions in it), display the results and ...
2
votes
0
answers
73
views
How can we call Mathematica functions from another server using the `wolframscript` Python library?
How can we use the wolframclient Python library to call Mathematica functions when Mathematica is running in an another server?
For example, if we have Mathematica ...
4
votes
1
answer
114
views
TaskWait, SocketObject, and WolframScript
I want to launch an asynchronous task with Wolfram Script to listen to a socket and print back information in the CLI. This was handled in previous versions by ...
2
votes
1
answer
250
views
Why Mathematica does not return explicit output [closed]
I am new to Mathematica. One thing that I don't get is why if I define a matrix and give it a name, then use the name in another function, I get back the function itself. However, When I use an ...
1
vote
1
answer
127
views
4
votes
1
answer
193
views
Empty .png figures generated by a function "PlotWithGrid" whereas no problem with Export function
I have an issue about a .wls script that I can't manage to solve for the moment. I execute it with wolframscript interpeter on ...
0
votes
0
answers
84
views
Reading an old file with newer versions of Mathematica
So I was given code for mathematica software in the form of an nb-file, but my mathematica sofware isn't reading it or detecting an nb file in my computer. I'm assuming this code was done a few years ...
0
votes
1
answer
35
views
Weird behaviour when taking input from the terminal using $ScriptCommandLine
I am trying to create a .wl file that can be run from the terminal using wolframscript. The script looks something like
...
0
votes
1
answer
82
views
Getting Error on differential equation Mathematica [closed]
There is a Differential equation that I had to Implement on Mathematica. But I am getting this error over and over. don't know what I did wrong
I tried this but does not work.
...
2
votes
2
answers
122
views
Plot issue : put a legend instead of a top label
I have an issue about putting a legend consisted of a text and numerical value instead of a label.
For example, with this command line :
...
1
vote
1
answer
73
views
Plot issue : bad label ordering with concatenation of strings
I have an issue about a label which is consisted of a variable name [Omega]BD and a numerical value associated.
Firstly, I put the BD subscript to ...
0
votes
1
answer
163
views
Export all figures and plots produced from a Wolfram script into a single PDF
Here is a .wls script that produces different images into .jpg format. I would like
to export directly all the images in a same ...