Questions tagged [iteration]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
81 views

Using Loop to find a specific Energy

I am given a Hamiltonian: ...
user avatar
  • 181
2 votes
1 answer
189 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
93 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
58 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
112 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
120 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
244 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
  • 951
2 votes
3 answers
249 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
315 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
57 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
114 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
112 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
48 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
469 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
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
45 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
34 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
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
130 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
130 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
112 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
88 views

Iteration limit exceeded

I am trying to adapt the following piece of code (coming from this answer): ...
user avatar
  • 6,104
6 votes
1 answer
284 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
274 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
1 vote
0 answers
101 views

FoldList and Compile [closed]

Let me elaborate my previous question about Foldlist and Composition. ...
user avatar
  • 99
1 vote
0 answers
92 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
118 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
56 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
1 vote
1 answer
89 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
  • 95
0 votes
1 answer
72 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
65 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
2 answers
121 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
1 vote
1 answer
188 views

How to code this iterative process?

I am facing difficulty to realize this double iterative process. The equations in question are The flow chart for the iterative process is given as The different parameters are defined as ...
user avatar
  • 11.6k
1 vote
1 answer
142 views

Optimizing my code for Broyden's method

The following code is my attempt of employing Broyden's method for root finding on the function $f(x,y)=(e^{xy}-y^2-2,\cos(x+y)+\frac{1}{2})$. Where the first matrix is the Jacobian, then it gets ...
user avatar
  • 553
-2 votes
1 answer
36 views

Nest not giving desired results

I am trying to use Nest to find result using fixed point iteration method, but when I find $g(x)$ and put it in Nest, it doesn't ...
user avatar
1 vote
1 answer
342 views

Fixed point iteration with While or Do Loop

I need to write a while or do loop to perform the iteration $x_{n+1}=Cos(x_n)$ with initial value $x_0=1$ and stops when the absolute value of the difference between two consecutive iterations is $|x_{...
user avatar
1 vote
1 answer
71 views

Define/store individual elements of Table output for back-substitution

At its core, mine is a very simple communication error between me and Mathematica that I haven't been able to crack, so I do apologise if it seems embarassingly inane. Please consider the following ...
user avatar
2 votes
2 answers
114 views

Using iterative functions to specifically sort a list

The following code sort the list li in a such way that consecutive terms $t_n,t_{n+1}$ are of the from ...{x_,y_}, {y_,z_}.... i....
user avatar
  • 2,503
0 votes
0 answers
68 views

How to update a function with previous iterate?

I'm trying to solve a differential equation numerically, and it has led me to a non-linear system of equations which I wish to solve using Newton's Method, which, for systems, is given by (for 3 ...
user avatar
1 vote
2 answers
159 views

Issues with convergence of an iteration of numerical integrals computed with NIntegrate

This is my first question on Stack-Exchange. I am not an expert in numerical integration and I am having issues of convergence with some numerical integration. I am trying to solve numerically a ...
user avatar
  • 41
0 votes
2 answers
156 views

Using Table to iterate over two lists element by element instead of as a matrix

So I have two lists generated in the following fashion, I don't know if it's the most efficent way to get these, but that's beside the point right now. ...
user avatar
0 votes
1 answer
382 views

Newton's divided differences iteration [duplicate]

I am trying to write a program that forms the interpolation polynomial for a given function on a given interval for any number of data points n. I wish to write a formula that will compute all of the ...
user avatar
0 votes
1 answer
103 views

Query in For loop

(I did not know how to write this properly. Excuse me for that.) ...
user avatar
  • 226
0 votes
0 answers
61 views

Avoiding Tables, Do and other loop construction

In my work I have a lot of cases, where I should calculate non-listable functions for a quite large number of points. To be more concrete, consider first listable function ...
user avatar
1 vote
0 answers
54 views

Find parameter ranges of a function whose value is within a window by sampling points

Problem: I want to find the ranges of the parameters for a function $f(x,y,z)$ when $0.9 < f(x,y,z) < 1.1$. All parameters are bounded $x , y, z \in [0,1]$. In the real problem the function ...
user avatar
  • 111
3 votes
1 answer
42 views

How can I find the maclaurin coefficients of different iterations of the same function?

I'm rather new to Mathematica so I would greatly appreciate any help. I want to find the series expansion coefficients of iterations of a function and export them as a .csv. Here is what I have ...
user avatar
3 votes
2 answers
49 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 ...
user avatar
  • 205