# Questions tagged [iteration]

The tag has no usage guidance.

173 questions
Filter by
Sorted by
Tagged with
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 ...
539 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). ...
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 ...
703 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 ...
760 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 ...
448 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 ...
349 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 ...
319 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, ...
258 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, ...
301 views

### How to iteratively build a list?

I have the following c++ code that I want to translate to Mathematica. ...
369 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 ...
778 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 ...
82 views

### RecurrenceTable and While

Good day. Let's take an example from Help on RecurrenceTable: ...
536 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 ...
287 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: ...
292 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 ...
296 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 ...
491 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 ...
145 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. ...
342 views

...
223 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, ...
93 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, ...
123 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 ...
138 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 <...
70 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. ...
84 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 ...
88 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 ...
125 views

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

Are there any configurations to fix it? Test code: ...
140 views

### How do we optimise double Tables?

I have made the following code which I shall explain it in two parts: First Part: ...
459 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 ...
361 views

### Efficient implementation of Non-Maximum Suppression

I would like to know is there is a way to do this: ...
155 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: ...
124 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 ...
120 views

### Iterative comparison between different vectors

I have some soccer outcomes for each league round to import in a data form similar to that: ...
770 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: ...
367 views

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

I have the following code: ...
395 views

### Better way to do such iteration

Consider such an iteration function ...
140 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 "...
186 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 ...
118 views

### Symbolic nest expressions

I'm trying to understand how to use symbolic expressions as arguments. The following example represents my problem: ...
122 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$ ...
110 views

This code ...
468 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 ...
308 views

### How can I iteratively add elements to a list

Basically I want to make a histogram with a list of dates by using DateHistogram[]. However I have the data of the dates in nested list format, with elements like ...
112 views

### Iterative simultaneous numerical optimization of two functions

p = y 10 - 2 x^2 + 5 x; q = 20 y x - y^2 + 2 x; I want to maximize both functions simultaneously (Maximise p to get x and Maximise q to get y). I know that I could ...
53 views

### How to use ReplaceAll iteratively over a list of lists?

I want to build a matrix J for each of the solutions of an equation. And each solution is also a set of 3 variables (x,y,z). In ...
57 views

### NestWhileList stop criteria for second appearecnce of element

How i can stop evaluation of NestWhileList after second zero occurs? In my variant it stops at the first step. ...
152 views

### How to use NestList for coupled equations?

I have a code that works for a single equation. How to I use NestList for two equation that are coupled? Below is the code for single equation, ...