# Questions tagged [iteration]

The tag has no usage guidance.

156 questions
Filter by
Sorted by
Tagged with
43 views

### Recursively create Graph from seed and Nest GraphUnion, keeping VertexStyle, EdgeLabels, VertexCoordinates, EdgeShapeFunction

TL;DR; GraphUnion does not preserve properties of the input Graphs. How do I combine two ...
• 31.2k
79 views

### How to find a specific spanning subgraph?

A spanning subgraph is a subgraph that contains all the vertices of the original graph. Given a graph $G$, I would like to write a function $f$ for finding a spanning 5-regular bipartite connected ...
• 1,179
305 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, ...
• 863
22 views

### Difference between SubstitutionSystem and StringReplace

I'm examining two-step substitution model: First step, division: {"A" -> "BC", "B" -> "AC", "C" -> "AB"} Second step, merging: {&...
• 531
100 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 ...
• 41
56 views

### Exponents in my Nest?

While playing around with nests I got an answer from WolframAlpha that I can not quite comprehend. For reference I was inputting power towers in Nesting form. Nest$[x^{\#1} \&, 1, 2]$ For example. ...
1 vote
53 views

### How do I construct and plot functions properly using NestList?

I am trying to construct a function using NestList and plot the values. Although the individually used and defined functions in my notebook seem to do the right ...
90 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 ...
114 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$ ...
1 vote
90 views

### Using Loop to find a specific Energy

I am given a Hamiltonian: ...
• 585
104 views

This code ...
• 649
223 views

### What's a functional alternative to nested Do loops?

How can I use functional code to achieve the same effect as the following procedural code Do[ Do[ f[i,j], {j,1,m} ], {i,1,n} ]
• 359
121 views

• 63
122 views

### Mathematica does not show anything after running for higher iterations

Consider a BVP: $y^{\prime\prime}=\frac{3}{2}y(t)^{2}$ with the boundary conditions $y(0)=4$ and $y(1)=1$. The exact solution is $y(t)=\frac{4}{(1+t)^{2}}$ and the initial guess is $y(t)=4-3t$. Now I ...
• 161
94 views

### Implementing While loop in module that will iterate correctly

I am attempting to write a module that prints an optimal path from a starting node to a destination node. The first node is 1 and the final node is 100 (though when module prints these they should be ...
• 65
53 views

349 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 ...
• 889
74 views

### FindRoot doesn't find root

I am facing a problem that my FindRoot doesn't find the actual roots. I am trying to make a loop that iterates my parameter sets (U0,X0,\Sigma0) to find sets that satisfy some conditions. Here is my ...
• 109
90 views

### The use of NestList

After read Michael answer, code use NestList to compute and feed in numerical integration. I want to learn this idea into my code. In the ...
• 445
52 views

### Converting 1D map into first order differential equation for bifurcation diagram code

I have existing code to plot bifurcation diagram for coupled first order differential equations. It seems to work for coupled differential equations. To test the code further, I use the simplest ...
• 863
37 views

### Flatten a pair of matrices within a list of matrices

I have a list of matrices, which I think is better to give an example using the code. ...
• 107
36 views

### Force list of colours to have same grayscale value, maintaining hue

A sketch of what I'd like to achieve is given by ...
• 8,005
522 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 ...
• 626
1 vote
53 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 ...
• 11
143 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, ...
• 863
151 views

### Repeating and Sequencing Procedures with two Do-loops

I have a Do loop where I'm looking for the value of certain parameters that respect the conditions inside an If, and with those values, a run another Do to make another calculation of an expression ...
130 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
111 views

### Iteration limit exceeded

I am trying to adapt the following piece of code (coming from this answer): ...
• 6,214
68 views

### How to use NestWhile to get it to work the way I want?

I have a vector th={0,0,...,1.57}. Now I want to choose the second element and change it by stepsize 0.2 until it is less than 1.57, I need these set of vectors: th={0,0.2,0,...,1.57} th={0,0.4,0,...,...
311 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 ...
• 239
281 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,124
80 views

### RecurrenceTable and While

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

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

Are there any configurations to fix it? Test code: ...
• 6,827
1 vote
105 views

### FoldList and Compile [closed]

Let me elaborate my previous question about Foldlist and Composition. ...
• 99
1 vote
98 views

### FoldList with Composition and parameter

Good day to everyone! I have two (just for simple example) functions and they compose a map: ...
• 99
131 views

### Generating a lattice by $𝑁^{𝑡ℎ}$ iteration of unit cell

This question is in continuation of the my previous question that was not clearly presented by me at all. I have a unit cell, and I would like to generate a lattice but in iterative order. For ...
• 673
63 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. ...
• 19k
1 vote
95 views

### How do I correctly iterate using Outer when an argument / slot is a nested list?

I have the following complex nested iteration situation. I begin with a list, data, that comprises 16 TemporalData objects Each TemporalData object contains 2 ...
• 115