Questions tagged [iteration]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
42 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 ...
user avatar
4 votes
1 answer
80 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 ...
user avatar
3 votes
2 answers
113 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$ ...
user avatar
-1 votes
0 answers
51 views

Integration does not converge in iteration

I have the following code to find a numerical solution for a singular BVPas attached in the picture. I have the following Mathematica code: (This code of this question can be found at Mathematica does ...
user avatar
1 vote
2 answers
84 views

Using Loop to find a specific Energy

I am given a Hamiltonian: ...
user avatar
  • 181
3 votes
3 answers
103 views

I need to create a series of polygons from a list of lists that form a stair step shape

This code ...
user avatar
  • 591
2 votes
1 answer
193 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} ]
user avatar
0 votes
1 answer
98 views

Plotting fractals in Mathematica for S iteration

Dears, I'm trying to plot the attached picture figures in Mathematica software. Let $T(z)=z-\frac{P(z)}{P^{\prime}(z)}$. The S iterative scheme is for $z_{0}$ a starting point and $y_{n}=(1-\beta_{n}...
user avatar
  • 169
0 votes
0 answers
64 views

Solve two equation by fixed point iteration method

I am tryin to reproduce the figure.2 of this paper. In order to obtain this plot, I need to find the global minimum of equation.(7) or equivalently solving two coupled equations of $\frac{\partial \...
user avatar
  • 1
0 votes
1 answer
119 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 ...
user avatar
  • 169
0 votes
1 answer
85 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 ...
user avatar
  • 65
0 votes
0 answers
49 views

Solving numerically Pdes and Odes and Iteration processes

Dears, I have the following equations: $x^{\prime\prime}(t)=\frac{3}{2}x(t)^{2}$ with $x(0)=4$ and $x(1)=1$. The exact solution is $x(t)=\frac{4}{(1+t)^{2}}$. Now the corresponding operator is $ Px=x+\...
user avatar
  • 169
3 votes
1 answer
123 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 "...
user avatar
  • 315
5 votes
3 answers
247 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 ...
user avatar
  • 1,043
2 votes
3 answers
252 views

Nested floor functions

I would like to compute a limit involving a particular nested floor function. For example: ...
user avatar
3 votes
4 answers
317 views

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

I have the following code: ...
user avatar
  • 618
1 vote
3 answers
58 views

Digits product and an iteration process

I would like to create a code which gives me the square of the product of the digits of a number, with the only rule that if a number has a 0, then it doesn't count in the product (for example, if the ...
user avatar
0 votes
1 answer
148 views

I'm beginner and do not how to plot the Basins of attraction by the methods

For a complex polynomial $P(z)$, define $T$ by $T(z)=z-\frac{P(z)}{P^{\prime}(z)}$, where $P^{\prime}(z)$ is the first derivative of $P(z)$. We consider Newton method for finding the roots of ...
user avatar
  • 169
0 votes
1 answer
120 views

How to use for loop in Mathematica?

in most of my job I have to repeat something for different part of data, for example making plot, usually the only thing need to change is index. Below is the example of the code which I have to ...
user avatar
  • 383
1 vote
1 answer
49 views

Why each iteration takes longer than previous one when using VariationalD in this loop?

I have a function $f$, and I would like to modify it iteratively to approach another one called $a$ (not because I think this is the best way to do anything, but for experimentation). For this, I use <...
user avatar
  • 137
10 votes
2 answers
471 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). ...
user avatar
0 votes
1 answer
95 views

Spurious renaming in nested Function construct

From the documentation of Function, I take this example (slightly simplified). Renaming the dummy or bound variable (y->y$ in the inner ...
user avatar
5 votes
2 answers
261 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 ...
user avatar
  • 755
0 votes
0 answers
72 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 ...
user avatar
  • 27
0 votes
0 answers
80 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 ...
user avatar
  • 445
0 votes
0 answers
49 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 ...
user avatar
  • 723
0 votes
0 answers
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. ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 7,759
5 votes
5 answers
513 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 ...
user avatar
  • 611
1 vote
1 answer
52 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 ...
user avatar
3 votes
1 answer
134 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, ...
user avatar
  • 723
2 votes
1 answer
137 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 ...
user avatar
3 votes
2 answers
118 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 ...
user avatar
  • 39
0 votes
0 answers
96 views

Iteration limit exceeded

I am trying to adapt the following piece of code (coming from this answer): ...
user avatar
  • 6,134
0 votes
0 answers
64 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,...,...
user avatar
6 votes
1 answer
294 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 ...
user avatar
  • 239
5 votes
1 answer
279 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 ...
user avatar
  • 1,114
6 votes
1 answer
79 views

RecurrenceTable and While

Good day. Let's take an example from Help on RecurrenceTable: ...
user avatar
  • 99
5 votes
0 answers
122 views

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

Are there any configurations to fix it? Test code: ...
user avatar
  • 6,817
1 vote
0 answers
103 views

FoldList and Compile [closed]

Let me elaborate my previous question about Foldlist and Composition. ...
user avatar
  • 99
1 vote
0 answers
94 views

FoldList with Composition and parameter

Good day to everyone! I have two (just for simple example) functions and they compose a map: ...
user avatar
  • 99
2 votes
1 answer
124 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 ...
user avatar
  • 673
5 votes
1 answer
57 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. ...
user avatar
  • 19.1k
1 vote
1 answer
91 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 ...
user avatar
  • 105
0 votes
0 answers
44 views

Why Mathematica doesn't compute the permutation products in my NestList[]?

I wrote the following: K = DihedralGroup[5]; K = GroupGenerators[K]; y = K[[1]]; x = K[[1]]; l = NestList[PermutationProduct[x, y], x, 4] But Mathematica gives me ...
user avatar
  • 4,801
0 votes
1 answer
73 views

n-dimensional recursion [closed]

I am trying to set up a recursive function that generates n number of differential equations for Subscript[y, n][t] This ...
user avatar
1 vote
1 answer
70 views

Iterative and recursive approach to generate Fibonacci sequence

I'm new to use Mathematica and using this demo project to understand Mathematic demo example. I modified example code to only plot the runtime of recursive version of Fibonacci sequence runtime: ...
user avatar
  • 47
1 vote
1 answer
54 views

Plotting iterates of a piecewise defined map

This is a follow up question to the one I asked here. I’ve succeeded in figuring out how to plot the first image of my piecewise defined transformation $T: [-1,1]^2 \to [-1,1]^2$, but now I want to ...
user avatar
  • 125
1 vote
2 answers
123 views

Generating a $N^{th}$ iterative line graph from the adjacency matrix $M$. How to generate $M$?

I have a unit cell, and I would like to generate a lattice but in iterative order. For instance, consider the following example-- The unit cell is (zero iteration) This figure is generated by a ...
user avatar
  • 673
0 votes
1 answer
62 views

How to write a function returning Chebyshev Polynominals of the first kind using Nest[]? [duplicate]

I want to create a function returning the Chebyshev polynomials of the first kind using the in build Nest[] function, preferably with a pure function. I know there exist an in-build function for the ...
user avatar