Questions about looping or recursive structures that do not complete. Such structures include While, For, FixedPoint, and NestWhile. Also user defined functions that make recursive calls to themselves.

learn more… | top users | synonyms

0
votes
1answer
46 views

looping in mathemtaica for using the current value as initial state of next value [on hold]

i have some initial state $psi[x,t]$. I perform some operation on it and store the value in another state $pi1[x,t]$. Now on the next step i have to use $psi1[x,t]$ as initial state and perform the ...
0
votes
1answer
67 views

Running function - updating list - run function etc

I am making a larger program, so I would prefer to give a short example of my problem: ...
1
vote
2answers
60 views

If/else re-evaluate (integer only solutions)

I am trying to get Mathematica to do an if/else loop. I can get as far as the if, but I would like it to re-evaluate until only integer solutions are found. Here is what I have: ...
2
votes
1answer
80 views

Recursion when randomizing elements in a list

I want to randomize certain elements of a list; Since the code list = {a, b, c, d, e, f, g}; list[[{1, 3, 5}]] = RandomSample@list[[{1, 3, 5}]]; list works fine, ...
2
votes
1answer
110 views

Infinite loop with While is very processor-intensive [closed]

This simple line of code: While[True, Pause[1]] uses 55% of one CPU core on my computer. Are there more efficient ways to construct simple infinite loops in ...
1
vote
3answers
205 views

Code hanging inside a For loop

I'm pretty new to Mathematica (and functional programming in general). I'm working on some code to find winners (maximal values) in a list. The code I have that is hanging is this line. ...
0
votes
2answers
101 views

Conditional Table

I have following : SeedRandom[2] Table[Table[RandomInteger[100, {100, 10}][[r, s]] == x[r + s], {r, 1, 10}], {s,1,10}] How can I set condition inside Tables?Such ...
0
votes
1answer
88 views

While loop not breaking when condition is met

I am having trouble with the while loop not breaking, ...
3
votes
2answers
155 views

Export in Manipulate, infinite loop

I want to make export of a plot inside Manipulate, but only once. However, this code runs infinitely and does export infinitely: ...
2
votes
2answers
131 views

While loop doing cell evaluation not completing

I am trying to get a loop structure using While to repeatedly evaluate another cell referred to in its body (using a cell tag). ...