Skip to main content

# Questions tagged [iteration]

The tag has no usage guidance.

196 questions
Filter by
Sorted by
Tagged with
0 votes
1 answer
105 views

### How to obtain a solution to a system of equations using the method of successive approximations? [closed]

My question is not offtopic at all! It's about problem of syntax in Mathematica. It is necessary to obtain an analytical solution to a system of equations using the method of successive approximations ...
2 votes
2 answers
46 views

### How to fix parameter locally for iterating recursion equations

The following is a simplified version of a more detailed problem. I have two coupled recursion equations of two variables, x and y. One equation also depends on a parameter, c: ...
• 393
4 votes
2 answers
132 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 ...
• 4,632
1 vote
1 answer
98 views

### Use Mathematica to Implement Blahut–Arimoto Algorithm (Part: Algorithm for Rate-Distortion)

Try to use Mathematica to implement Blahut–Arimoto algorithm (here we just focus on the part of computation of Rate-Distortion). Here are some reference code snippets: Python The algorithm looks ...
• 1,683
1 vote
1 answer
105 views

### Use Mathematica to Implement Blahut–Arimoto Algorithm (Part: Algorithm for Channel Capacity)

Try to use Mathematica to implement Blahut–Arimoto algorithm (here we just focus on the part of computation of channel capacity) Here are some reference code snippets: MATLAB(a) MATLAB(b) Python The ...
• 1,683
0 votes
0 answers
45 views

### Ising Model Simulation Increase Efficiency

I implemented a 2d simulation of Ising Model for zero external magnetic field. Below you can find the function I wrote to calculate the energy (periodic conditions) ...
2 votes
1 answer
150 views

### How to Optimize Integro-Differential Equation Solving Time in Mathematica?

I'm trying to solve an integro-differential equation numerically in Mathematica that models the evolution of a physical system . However, the computation takes a very long time and doesn't yield a ...
4 votes
2 answers
237 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 ...
• 115
13 votes
4 answers
398 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. ...
• 243
2 votes
1 answer
78 views

### Problem designing test for NestWhile?

I am trying to use NestWhile with a custom test as follows: ...
• 5,421
3 votes
3 answers
215 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 ...
0 votes
1 answer
96 views

### Speed up multiple Do loop

I am writing a script to simulate the multi spin system and for that I need to use three successive iterations. The code runs fine but takes a long time. I need the final FID. So, has there a way to ...
• 473
0 votes
0 answers
32 views

### How to find clear solution for iterative problem by condition $<v_k ,v_n>=0$ If $k!=n$

I want to find x[n] by v[n] values without x[n] in solution by iterative below problem: <...
1 vote
2 answers
80 views

### Can't use iterative variable as part specification [closed]

I've got the following mathematica code: ...
0 votes
0 answers
47 views

### FindMinimum with many Sums and NIntegrates is very slow

I want to calculate the global minimum of an equation which has several hundred Sums (I used 300 in this code), but the calculation is very slow. My code is as ...
• 101
1 vote
3 answers
102 views

### Listing iterations inside a while loop

I wrote a code for bisection method root approximation. However, I wanted to know the value of the root every iteration. I tried using the Union function to save each iterated value in a set but it ...
• 43
0 votes
1 answer
133 views

### Exponential and logarithmic functions slow the higher iterations in Mathematica

I want to solve BVP given in the (39)-(40) by the method given below these equations. I have written this method in Mathematica as follows. However, for n=1 it print the solution quickly but for ...
0 votes
0 answers
64 views

### A geometric application of Benford's law [duplicate]

I would like some help solving the following problem using Mathematica: Show that, no matter what the initial area of an equilateral triangle is, the sequence of areas (painted in black) of the ...
1 vote
1 answer
125 views

### A way to generalize my code for this non linear ODE problem

I am trying to solve the differential equation $y''(x) = y(x)+\sin[y'(x)]$ using "Fixed Point Iteration" over the interval $[0,1].$ Now using central difference method I arrived at the ...
• 219
1 vote
1 answer
113 views

### Extend the code for more variables (at least 100)

I have this code (not in best shape) for a problem in 3 variables. It does the job. The problem is I want to extend this to more number of variables around 100 at least. It is very painful to extend ...
• 219
2 votes
1 answer
151 views

### How can I count iterations with NestWhile?

I'd like to count loop iterations for some substitution rules. For example: rule = {1 -> {0}, 0 -> {1}} init = {0} maxIter = 10 I'm going to avoid all ...
• 1,894
2 votes
2 answers
133 views

### Nested radical implementation

I am attempting to code $$F(x,n)=\sqrt{x+\sqrt{x+2\sqrt{x+\cdots +n\sqrt{x}}}}.$$ For example, $$F(x,1)=\sqrt{x+\sqrt x},$$ $$F(x,2)=\sqrt{x+\sqrt{x+2\sqrt x}},$$ and so on. I found the ...
0 votes
0 answers
66 views

### Successive multiplications using Mathematica tools

Successive rotations on the unit circle Given an arbitrary starting point $z$ on the unit circle in the complex plane, the goal is to compute a cycle of rotations by $\pi$/2 with successive ...
• 1,092
-2 votes
1 answer
68 views

### How to make faster of a code containing more iteration point? [closed]

I am trying to evaluate a code of the Power Series Solution method to get the results. Also, the time of evaluation depends on the parameters I am using. When the iteration point is 50, 60, or 80, it ...
2 votes
1 answer
79 views

### Sequence of lists

Let's say I have the following table, y=40; b=Flatten[Table[{i, j}, {i, 1, 2.25, 1.25}, {j, y - 5, y - 8, -3}], 1] then c is equal to, ...
• 867
0 votes
1 answer
91 views

### Question regarding initial guesses for Newton's method in AceGen/ AceFEM

I am trying to solve a system of equations with the command SMTNewtonIteration[]. This method needs initial guesses for the degrees of freedom I am looking for. Is ...
1 vote
1 answer
116 views

### How to find the minimum at each iteration?

I would like to iterate the table for {Q,0,3,1}, {R0,1,5,1}, the values of m=[3.83171, 7.01559, 10.1735, 13.3237, 16.4706, 19.6159, 22.7601, 25.9037] and calculate the corresponding k and Ra. Also, I ...
• 413
2 votes
2 answers
253 views

### Solve can’t solve this… is there a way to approximate it?

I've been toying around with mortgage/loan calculations and spreadsheeting. The loan formula is as follows: A = p * r *(1+r)^n / ((1+r)^n - 1) A: payment per period p: principal r: interest rate n: ...
0 votes
1 answer
104 views

### Wolfram Alpha simplifying $\sqrt{1+x^\sqrt{1+x^\sqrt{1+...}}}$ incorrectly [closed]

I am pretty new to Wolfram Alpha. I want Wolfram Alpha to find the derivative of $\sqrt{1+x^\sqrt{1+x^\sqrt{1+...}}}$. At the moment, I am having trouble with Wolfram Alpha simplifying it incorrectly. ...
• 113
2 votes
1 answer
80 views

### CPU time in iteration process

Let $Tx=\frac{x}{2}$ for all $x\in[0,1]$. Let $x_{0}\in[0,1]$ and set an iterative sequence $\{x_{n}\}$ by the method $x_{n+1}=Tx_{n}$. Now if $x_{0}=0.8$, then I get a convergent sequence towards the ...
5 votes
1 answer
105 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, ...
• 365
8 votes
5 answers
844 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,672
0 votes
1 answer
43 views

### function with parallel iterations

coprimesParallelIter[n_] := DistributeDefinitions[GCD]; ClearAll; ParallelTable[If[GCD[i, n] == 1, i, Nothing], {i, 1, n - 1}] // Flatten // DeleteCases[Nothing] ...
• 515
3 votes
3 answers
416 views

### Better way to do such iteration

Consider such an iteration function ...
• 7,148
1 vote
3 answers
518 views

### How to plot an imaginary number, i, power tower as done in the following way?

Can somebody explain what two variables exactly they have plotted against each other to get such graphs, and how one would go about getting this graph in Mathematica?
• 43
-2 votes
2 answers
175 views

### How do I create cobweb iterations or stair steps **WITH ARROWS** to show attractive and repulsive fixed points for a graph? [closed]

I'm new to Mathematica, so I would appreciate any help. How do I create cobweb iterations or stair steps WITH ARROWS to show attractive and repulsive fixed points for this graph? I want it to look ...
• 43
-2 votes
1 answer
122 views

### How to plot an iterative function of y(n+1) against y(n) in order to analyze the convergence of real power towers? [closed]

I'm new to mathematica and was wondering how to plot an iterative graph for power towers. If there is a power tower y= x^x^x^x^x^x^... we can rewrite it as an iterative equation in the following way: ...
• 43
0 votes
1 answer
121 views

### How can I nest a complex function?

I am examining the mandelbrot set so I need to iterate the function f[z_Complex, c_] := (z)^2 + c Besides, I want to choose the complex numbers dynamically from ...
2 votes
3 answers
131 views

### Iterative method for fixed point of a mapping with domain and range contained in $\mathbb{R}^{2}$

Let $X$ be a metric space and $T:X\rightarrow X$ be a function. A point $x\in X$ is called a fixed point of $T$ if $x=Tx$. For example, if $X=[0,1]$ and $Tx=\frac{x}{2}$ then $T$ has a unique fixed ...
0 votes
1 answer
246 views

### How to do a Picard iteration on a Volterra equation? [closed]

I want to approximate the solution of a Volterra integral equation using the Picard method, and plot the approximated solutions. For this I have the equation: where the functions and coefficients are:...
• 605
1 vote
1 answer
51 views

### How can I define an operator and plot its iterates?

I am trying to define a function (an operator) that "integrates then translates" a function. More specifically, for an input f[x], I want to integrate it as \int_0^x f[t] dt, then translate ...
• 113
0 votes
0 answers
56 views

### Iterating an operator on a polynomial

I want to be able to build an operator $S$, on a polynomial in multiple variables which does something like this $f[x,y] =$ some polynomial $S[f][x,y] = y*f[y,x]$ And then for a specific choice of $n$,...
• 101
1 vote
2 answers
106 views

### Nested pure function argument as table

I made a nested pure function Nest[(x^2)/ ((2x+1) + #)&, x,n] I would like that for each iteration the value of x increment of 1, to have something like \...
3 votes
1 answer
77 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. ...
2 votes
0 answers
55 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 ...
• 36.9k
0 votes
1 answer
172 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 ...
• 2,059
6 votes
4 answers
349 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, ...
• 893
0 votes
0 answers
24 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: {&...
• 1,894
3 votes
1 answer
140 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 ...
• 61
1 vote
1 answer
70 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 ...