# Questions tagged [iteration]

The tag has no usage guidance.

195 questions
Filter by
Sorted by
Tagged with
386 views

### Reproduce the annulus fractal

I've made some attempts, but I don't know how to set the color and thickness of the circle. ...
• 201
1k views

### Simple Fractal square

I am working on a math question about infinite series, and one of the question images is below. Each new white square has an area that is 1/4 of the previous square. Always looking to learn elegant ...
• 3,780
698 views

### What is the most efficient way to define a Loop until function?

Mathematica has the While function which is very convenient when we need to process some code until the attainment of a certain state (identified with a condition). ...
• 1,099
1k views

### Simple Birth Death Process

I am trying to implement simple birth death process. Why my code does not work? Any suggestion. Thanks. Cross posted http://community.wolfram.com/groups/-/m/t/1205656 ...
• 10.8k
746 views

### Delete repeating elements across sublists

I have a list like this test = {{1, 3, 5}, {7, 2, 8, 5}, {7, 1, 3}}; The list is guaranteed to have duplicates only across sublists and not within. I would like ...
• 695
834 views

### Create a regular polygon with n vertices given two points

I want to create a regular polygon from the initial two points $A$, $B$ and number of vertices $n$, regularPolygon[{0, 0}, {1, 0}, 3] gives ...
• 5,652
1k views

### Coding the Mandelbrot Set for Beginners

I'm new to Mathematica and will need some help in coding the Mandelbrot set. I don't want to use MandelbrotSetPlot since I want to understand the interior ...
452 views

### How can I iterate this process?

a = RandomVariate[UniformDistribution[{0, 1}]]; b = RandomVariate[UniformDistribution[{0, 1}]]; c = RandomVariate[UniformDistribution[{0, 1}]]; a + a b + a b c ...
• 867
358 views

### Using Nest to build continued fraction

To build basic continued fraction one can simply use: Nest[1/(1 + #) &, x, 3] However, it's unclear how using Nest ...
• 357
344 views

### Using multiple hashtags in NestList

Are multiple hashtags allowed in NestList usage? If yes, how to implement it? Example, f[{x_, y_}] := {x + y, x - y}; NestList[f, {100, 75}, 5] My attempt, ...
• 883
636 views

### Replacing elements at a single level in a nested list

I want to replace all instances of 0 in the outer most level of a nested list with 1. However, when I use ReplaceAll as ...
• 1,043
373 views

### How to create a nested list of variable depth with indexed elements

i want to obtain this definition of a nested list t = Table[C[i, j], {i, 3}, {j, 3}] with arbitrary depth, ...
• 856
359 views

### How to iteratively build a list?

I have the following c++ code that I want to translate to Mathematica. ...
• 163
485 views

### Heat transfer with functions defined on different domains

I'm attempting to model a situation in which a polymer initially at a higher temperature is sandwiched between two cooler metallic mold pieces with conductive boundary conditions in between the ...
• 249
86 views

### RecurrenceTable and While

Good day. Let's take an example from Help on RecurrenceTable: ...
• 99
555 views

### Best way to count nest depth in e.g. f[f[f[...[f[x]]...]?

What is the best way to count nesting depth in e.g. f[f[f[...[f[x]]...]? In other words, what function func is good for giving ...
• 763
297 views

### Iterate over deepest values in a nested Association

Is it possible to iterate over the values of the deepest layer of keys in a nested association? For example: ...
• 589
297 views

### How to recreate this complex iteration

I came across this image in a book Im reading: (taken from Rational Iteration Complex Analytic Dynamical Systems from Steinmetz. I hope it is okay to share it here) and I try to recreate it in ...
• 1,134
330 views

### ParallelDo barely faster than Do

I am new to parallel computing, so I am trying to get a grasp as to how this works. Many posts seem to indicate that overhead (like here) is a common pitfall, but I do not see why this would be the ...
• 1,511
148 views

### Building Truncatable Primes using Nest(List), While, Fold

Here is a video on Truncatable Primes. I tried to build it myself. Here is what I have tried using the method in the video for left Truncatable Primes. ...
• 1,632
369 views

...
• 4,986
269 views

### NestList: How to have a parameter that is changing as a function of nest index, n?

I have a NestList construction NestList[STEP[#] &, m0, NT] where a function is being called repeatedly that acts on a list and returns a list, for details, ...
• 614
104 views

### List operation for beginner Usage of #1 and #2 (in stead of using for loop)

I have trouble using list operation of #1 and #2. Could you please tell me how to make it? I prepared the list as below, ...
• 343
135 views

### Nest or fold a series of geometric transforms

I have a requirement to perform a series of GeometricTransformation[]s using the AfineTransform[] function. I use these to set ...
• 197
158 views

### Recursive nesting with parameter

I would like to apply a function f recursively to an expression expr an arbitrary number of times. However the catch is that <...
74 views

### Functional iteration of list of functions

I'm getting completely stumped on writing a function makeIterate that constructs an iterated structure out of a list of functions e.g. ...
• 19.7k
92 views

### What is the most efficient way to implement NestPairWhileList[f,expr,test,g]

Question NestWhileList[f,x,test] lets you iterate a function until a condition is satisfied, outputting the list of iterated values ...
92 views

### Removing from a sublist, inserting into another one

From a list like test = {{1, 3}, {2,7, 8}, {5,6}}; I would like to randomly select k elements, lift them out of their current ...
• 695
126 views

### NestList in 12.1/12.2 is 10x slower than 11.3/12.0

Are there any configurations to fix it? Test code: ...
• 9,948
236 views

### Given two functions, generate all nested applications of the functions to a given order

I have two functions $f$ and $g$. Given some order parameter $n$, I want to created all nested applications of $f$ and $g$ and save them in a list. For example, for order 1 we will have ...
• 95
117 views

### How to use functional iteration with changing function?

I recently came across this problem on reddit. The problem is supposed to be read like a snake, and the result of each succesive operation is sent to the next operation: There are 9 blank boxes and ...
• 3,937
146 views

### How do we optimise double Tables?

I have made the following code which I shall explain it in two parts: First Part: ...
• 3,016
500 views

### How to nest multiple functions with multiple variables

I'm trying to solve coupled equations by using iteration. There are two functions $G$ and $H$ that I need to find. In the code, G and H are actually lists of numbers. I start by using a simpler ...
363 views

### Efficient implementation of Non-Maximum Suppression

I would like to know is there is a way to do this: ...
232 views

### Fixed point of a vector

It seems to me that FixedPoint is designed to work with a particular value, but what if we want it to operate on a vector instead? I start with an nxn matrix mat and the function: ...
181 views

### Two variable recursive integral equation

I'm trying to improve the question posted in Solving an integral vectorial equation by iterations but when the iterations are for two variables. I mean, suposse that I have the following integral ...
• 491
131 views

### Iterative comparison between different vectors

I have some soccer outcomes for each league round to import in a data form similar to that: ...
• 401
859 views

### Iteration on a matrix

I want to update "matrix1" 100 times. "matrix3" will be new "matrix1" and it will iterate 100 times. Should I use a loop or function? First iteration is: ...
211 views

### How to reuse an iterator in different functions?

How can I reuse iterators? For example, instead of Table[i, {i,0,10}] Table[i^2, {i,0,10}] Table[f[i], {i,0,10}] write something like ...
407 views

### Defining a function iteratively without Mathematica getting stuck in a recursion loop

I have the following code: ...
• 636
412 views

### Better way to do such iteration

Consider such an iteration function ...
• 7,138
152 views

### FixedPoint not working, despite quick convergence of sequence [closed]

Trying the computation below, with Mathematica 13.0.0, I am not getting a result returned. FixedPoint[Cos, 0.85] This appears in the 3rd edition of "...
• 315
120 views

### Symbolic nest expressions

I'm trying to understand how to use symbolic expressions as arguments. The following example represents my problem: ...
• 153
284 views

### Using the Fold function with multiple parameter inputs [closed]

I want to construct something like: f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, f[a, b, c, x]]]]]]. I believe this can be done using the Fold or Nest ...
• 39
130 views

### Solving an integral vectorial equation by iterations

I'm triying to solve a problem like the following: $$\binom{f(t)}{g(t)}=\binom{f_0(t)}{g_0(t)}+\lambda\int_0^t ds\hat{A}(s)\binom{f(s)}{g(s)},$$ where $f_0(t),g_0(t)$ and $\hat{A}(t)$ (a $2\times2$ ...
• 491
119 views

This code ...
• 930
85 views

### How to do simple list traversal? And how do I insert this in a function?

I want to make a function that takes as input a list of numbers and returns a list of 4 lists; the first returned list holds all positive real; the second returned list all negative real; the third ...
• 31
577 views

### two tier compound interest problem

I am trying to make sense of how mortgage repayment figures are calculated for two tier mortgages, where you fix your interest rate for a certain period and after that period, you fall back to the SVR ...
• 701