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
6
votes
2answers
116 views

Destructuring a list containing two items to use it as arguments to a binary function

I'm experimenting with the Through function. I suspect there is a way to use that function to obtain both the mean and difference of two values. But this doesn't ...
2
votes
2answers
87 views

is there something like a “foreach” mode from the command line? Like in perl?

With perl we can run perl -p . That wraps a foreach loop around the code and executes the code on the file. What I'm looking for is something like StringReplace[filename,"\t"->","] and then I get a ...
0
votes
0answers
43 views

Using allocated cores for subkernels on computing cluster

I am really struggling to get to run my Mathematica job on a high-performance-computing cluster (TORQUE based). What I have is: A wolfram script (wls), that is wrapped in a ...
9
votes
1answer
110 views

Importing Packages to .wls without shadow definitions and context specification

I am trying to import a package that works correctly when I use it in a notebook in a wolframscript .wls. I get a weird shadowing problem, however. Here is a minimal working example ...
5
votes
1answer
105 views

How to execute an existing notebook with Wolfram Engine?

[My related question: mwe-for-compiling-functions-into-standalone-dll-and-calling-them-in-python - here I am exploring an alternative] I have downloaded, installed and activated the wolfram engine (...
0
votes
0answers
36 views

Is each instance of a running wls script assigned a separate kernel?

I really like using wls scripts for running my Mathematica calculations on large datasets, as everything can become neatly automated. My question is about the ...
0
votes
0answers
19 views

Export data in a .wls script

I am currently facing the problem that the Export function does not behave as expected if I execute my code as a .wls script. I execute my test.wls file in my ...
0
votes
0answers
70 views

Solve ODE system efficiently with mathematica

I've been trying to solve a system of ODE's with mathematica, which is a master equation of a hierarchically organized tissue model, where I want to quantify the number of cells at level 'k' with 'm' ...
7
votes
1answer
327 views

Installing WolframScript (12) on OSX (Catalina)

I did a clean install of Catalina (OSX 10.15) and Mathematica 12.0 installation was flawless. However I can't install WolframScript which I greatly need. During the installation, after typing my ...
0
votes
1answer
44 views

How to extract the last output from the Maximize

Pitty on me! Still a beginner. After using Mathematica for 8 years and spending an hour on google, I remained unsuccessful to find an answer of: How to extract the last element of the output of ...
3
votes
1answer
51 views

wolframscript command line output from ParallelDo kernels contains lots of gibberish

I run this code: ParallelDo[ Print["Hi"];, {i,Range[2]} ] And I get this: ...
0
votes
0answers
38 views

script to remove multiple Connection Linkedin

Unfortunately i have so many Connections About 20,000 in Linkedin, so i need to delete them all in multiple way, but Linkedin allow one by one. i searched there's a way in Internet, but all of them ...
1
vote
0answers
46 views

Script aborts when I try to build a very large list

I am running the code below ...
0
votes
1answer
33 views

Conditions for solving in NDSolve

I'm trying to solve a system of ODEs but each variable is a probability so I should solve each variable for a range between 0 and 1 and with the sum of all variables equal to 1. This is the system ...
5
votes
1answer
68 views

How do I reliably read from stdin using wolframscript?

I am trying to direct a stream of data to a wls script in a command line environment. Wolframscript provides the ...
0
votes
0answers
49 views

Wolframscript - no output from command when exec'd from php

I am trying to run a simple command via php: echo shell_exec('wolframscript -code 2+2'); However, I am unable to get any output from this command when run like ...
0
votes
1answer
64 views

WolframScript not simplifying output

I'm trying to multiply a matrix and a vector (imported from a csv) in Wolframscript to speed up a process normally done with Mathematica notebooks. This is my first time using Wolframscript, however, ...
0
votes
0answers
47 views

How to turn an algorithm into a function

I have written a script to help me find the several local minima of a dataset. It takes two arguments: the dataset list and an x-coordinate value that tells the script from where to start looking for ...
0
votes
1answer
82 views

Passing arguments into WolframScript in batch mode

I am looking for a way to passing arguments into a WL script when WL run in batch modes. The test script is: ...
0
votes
0answers
34 views

Passing arguments into package from a command line

I am interested in running the same experiment with the different initial state. So, I am looking for a way to passing arguments into a plain text .m file from the ...
1
vote
1answer
60 views

Run a shell script and pass arguments from inside mathematica

Is it possible to run a shell script AND pass it arguments from Mathematica? I have searched thoroughly and been unable to find a way to do this. I want to avoid having to write a .wls for this ...
1
vote
0answers
37 views

Saving a WolframScript File to the cloud?

Is there a way to save the current (or some target) WLS file to the cloud programattically (via wolframscript)? So if we are editing, i.e., ...
1
vote
0answers
19 views

Loading a file immediately upon launching the wolframscript REPL

When running, i.e., a bash shell, usually a file is automatically imported upon launch for convenience (~/.bashrc). Can one do something similar when launching <...
0
votes
0answers
51 views

What techniques have you employed to avoid loop in Mathematica? [duplicate]

It appears to me that loop in mathematica is very slow (compared with matlab). Since many people still use mathematica to finish their work, there must be some techniques to bypass this problem. ...
1
vote
0answers
19 views

How to execute .wls as a web call through Windows IIS

If I have a simple test.wls file (Print["hi"];2+2) that works running in Command Prompt, how do I get it to run through IIS on Windows Server? It just comes up with ...
7
votes
1answer
118 views

What is an example of of idiomatic “typed” WolframScript?

I'd like to make my own "typed function" in WolframScript. Suppose the type we desire is called money, and we'd like to make a function called ...
1
vote
1answer
52 views

Removing Extra Points When Finding an Audio Envelope

I am trying to reproduce Camtasia's way of displaying audio signals which is a strictly positive envelope of the audio signal and very easy for me to identify some sounds visually. These are displays ...
0
votes
0answers
43 views

Testing if a function input is an integer

I am wondering why code like digitback[n_Integer] := Framed[Reverse[IntegerDigits[n]]] can check if the input for the function is an integer (this is the ...
6
votes
1answer
102 views

TeXForm doesn't work in wolframscript?

Consider that $ wolframscript -cloud -code 'TeXForm[ (d u)/(d t)]' TeXForm[u/t] yet I don't have a local wolframscript kernel installed. Is this something ...
0
votes
0answers
71 views

WolframScript Causing Gibberish Characters When Printing to Console

Placing the following in ./file.wls: e1 = a (x + I y) E^(I θ) ComplexExpand[e1] and running ...
0
votes
0answers
18 views

Running CloudDeploy from WolframScript

The following $ wolframscript -cloud -code "CloudDeploy[Manipulate[n, {n, 1, 100}]]" yields ...
2
votes
0answers
41 views

Querying WolframAlpha from WolframScript

Is it possible to query WolframAlpha from a wolframscript query? The following yields $Failed: ...
3
votes
1answer
123 views

Creating flags to use with wolframscript?

Is it possible to create flags to pass arguments into a script with wolframscript? I am trying to pass multiple variables that correlate to specific keys. For example, wolframscript -script ...
2
votes
2answers
211 views

Mathematica code in fortran [closed]

I have an integral in which the integrand is a combination of ratio of modified bessel function of second kind. I am able to find the solution of this integral with mathematica Nintegrate module with ...
1
vote
1answer
68 views

How to create a find-and-replace code in Mathematica?

Let's say I have a group of X's characters that I want to cut down. I want to use a method similar to 'find-and-replace-all' tool from Word, which takes an amount of X's each time, deletes them, and ...
10
votes
1answer
406 views

How does one use the free Wolfram Engine for developers on Linux?

I just downloaded wolframscript on Linux. Downloading the "free wolfram engine for developers" gives me a ...
1
vote
1answer
57 views

Getting a link to a Wolfram Cloud notebook from a WolframScript query?

Is there a way to make something like wolframscript -code 'Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}]' -cloud spin up a new Wolfram Online notebook with the ...
1
vote
0answers
47 views

Getting wolframscript to print out error messages?

While running a .wls file from the command line using wolframscript, is there a way to get the error messages printed to the command line?
4
votes
1answer
70 views

Context leak in Wolfram Script?

hello.nb SetOptions[EvaluationNotebook[], CellContext -> Notebook] Print["hello"]; a = 1; Print[a]; Print@Context[] bye.nb ...
0
votes
0answers
23 views

Console Output to file corrupted

When i run WolframScript and write the output of a *.wls to a file and then modified the program slightly, i started getting these more exotic outputs. The function used is NetTrain. Does someone ...
-2
votes
1answer
31 views
1
vote
0answers
53 views

Passing custom options to WolframScript file

I have an example of WolframScript file file.wls with the following contents. ...
1
vote
0answers
23 views

WolframScript fails silently intermittently (but only when connected to internet)

When I execute "wolframscript" from a bash shell repeatedly, it sometimes starts up, and sometimes fails. Failures occur about half of the time. The failure is silent. If I turn wifi off (so that I ...
1
vote
1answer
210 views

Electric Field Plot

I want to show an electric field of several arrangements of point charges in xy-plane. I wrote a routine that plots an electric field of a charge: ...
0
votes
0answers
23 views

String getting modified after exporting to PDF

I create and export the plot: ...
0
votes
0answers
28 views

API is not responding

I am looking at the examples of wolframscript to learn its capabilities and syntax. In one of the examples the following API is considered. ...
0
votes
1answer
58 views

Writing a script that exports results depending on user input

Is there a way to tell Export to hold its arguments and just Export. I tried to use ...
1
vote
1answer
54 views

Disable Message Windows

Is there any way to disable Mathematica's internal popup windows, such as "Why the beep?" Cannot seem to find any documentation on the ability to turn it off, but need it turned off to write some ...
2
votes
1answer
53 views

How to export parameters in a text file?

I have some parameters defined in my notebook as, for example, a=1; b=2; c=3; and I want to export these parameters to a .txt file in which I have the following ...
0
votes
0answers
47 views

Wolframscript does not terminate

I have a little package and a script. The portion in the script is copied from the Mathematica notebook and finishes just fine within half a minute on my laptop. Now I want to run this as a script on ...