Questions tagged [procedural-programming]

Questions about Mathematica's procedural programming paradigm.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
52 views

Using Iterators within the WebSearch Command

I am currently trying to use the WebSearch command within Mathematica to search names from a Dataset that I have already imported. The names that I am trying to search are located in the 4th column of ...
2
votes
0answers
59 views

How would you rewrite these procedurally coded internal routines in functional form?

I came across the following two internal functions SimplifyDump`AbsToSign and SimplifyDump`SignToAbs that have been written ...
1
vote
0answers
35 views
1
vote
0answers
53 views

Implements the binary-searching style code in functional way

Given that I have a code snippet written in binary-searching way: ...
1
vote
0answers
29 views

Error while exporting multiple files

I have two questions. I am trying to export results from my calculation when I iterate. I am processing multiple files using code below: ...
1
vote
0answers
78 views

Using While properly

I am trying to make While[] work with function results and evaluate them at the same time. ...
1
vote
0answers
89 views

How can i set up an If or Do loop to follow this calculation procedure?

The following picture depicts the calculation procedure I wish to set up. The inputs are $T_r$, the chemical composition of the feedstock and constraints defined by the equivalence ratio. This ...
1
vote
0answers
67 views

Execute a notebook with a changing variable

I have created a notebook with one fix variable that I want to run from 1 to 100. Every time the whole notebook (all cells) shall be executed for the given number. At the end of the notebook, it shall ...
0
votes
0answers
37 views

RSolveValue, Table and general programming

If I have the following code: ...
0
votes
0answers
21 views

Conditional Loops with Random Samples

I would like to simulate the following process: Pick a random number between 0 and 1. Choose a final time $t_f$. Evolve a (complicated) function $f[t]$ from $t=0$ with small timesteps $\delta t$ (the ...
0
votes
0answers
26 views

Access a variable outside a loop

If the variable "avrami1" is a column with ten elements (array of 10*1), how can I access the variable "avrami1" outside the loop and get those same ten elements? ...
0
votes
0answers
53 views

How can I modify the code to speed up the `Do`?

I need to use the following code to do some calculations. But the running speed of this code is too slow. How can I modify this code to improve the running speed? ...
0
votes
1answer
36 views

Load multiple csv files and do iterative calculation for each file

I am trying to read multiple csv files and want to plot them all together, Lets say I have 3 files, file1 , file2 and file3 I want to average 3 files, and plot them all together, So far I have set ...
0
votes
0answers
54 views

help with improving my code

I am fairly new to MMA-12 and have written the following code to calculate possible coordinates (for given constraints [see If[]] in the code) and get the ...
0
votes
0answers
50 views

Variables for multiple data files plotting using same Mathematica notebook

I am not an expert in mathematica, I have this following code. As you see I import a text file under the name "MyPoint1", plot with "pAll" then I do some more calculation with more variables and ...
0
votes
0answers
33 views

Optimization of Do loop with multiple variables

I am pretty new to Mathematica and I would like to optimize a Do loop with multiple variables that I have. I have three lists of three elements each, with the condition that the first element must ...
0
votes
0answers
44 views

Running a complex notebook from a different master notebook?

I am trying to use the Dynamo notebook (https://www.ssc.wisc.edu/~whs/dynamo/dynamo_3S_v1.4.1.nb) in a loop over parameters. Basically, this software takes one matrix as input, solves ODEs and some ...
0
votes
0answers
46 views

The variable in the While loop does not change

I have a simple while loop. After running, the variable does not change: ...
0
votes
0answers
62 views

How can I count the number of days (Monday, Tues, etc) in a year?

I am new to Mathematica and for fun am trying some of the challenges. The one I am working on now is: ...
0
votes
0answers
68 views

Using Map function with NDSolve

I would like to solve a set of differential equations but vary one parameter, KieP, between 900 and 1100. The solution for a given parameter has many peaks. I would then like to interpolate between ...
0
votes
0answers
85 views

Iterating a Module

I have a Module that can act on other Modules, which is given as Kk[EE,p,z1,z2,z3,K_func] and I am trying to iterate it, such that ...
0
votes
0answers
25 views

Finding trivial solutions, of the type 0 = 0, of an equation involving su(N) structure constants

so I have a bunch of equations $f_{abc} = f_{egd}m_{ae}m_{bg}m_{cd}$ (sum over repeated indices), where $f_{abc}$ are the structure constants of $su(N)$, for some $N$, and $m_{ab}$ are elements of ...
0
votes
0answers
195 views

Iteration problem using NestList or Do

I am trying to model a tank with discontinuous flow into the tank and discontinuous flow out of the tank. I do it numerically. You can imagine a tank to which I feed blue balls at timepoint t0, red ...
0
votes
0answers
132 views

Do loop with step size being being a doubling factor

Right now I'm doing loops like this: For[n=10, n<1000, n =2n, Do Stuff]. Is there a way to do this as a Do[] loop? I know ...