Questions tagged [iteration]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 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) ...
Gianmarco Morbelli's user avatar
2 votes
1 answer
147 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 ...
Roy Smith's user avatar
4 votes
2 answers
232 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 ...
JohnnyB's user avatar
  • 95
13 votes
4 answers
374 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. ...
vector's user avatar
  • 201
2 votes
1 answer
75 views

Problem designing test for NestWhile?

I am trying to use NestWhile with a custom test as follows: ...
Red Banana's user avatar
  • 5,329
3 votes
3 answers
211 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 ...
homocomputeris's user avatar
0 votes
1 answer
85 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 ...
P Pyne's user avatar
  • 453
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: <...
user68119's user avatar
1 vote
2 answers
73 views

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

I've got the following mathematica code: ...
Sebastian 's user avatar
0 votes
0 answers
45 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 ...
user43830's user avatar
  • 101
1 vote
3 answers
98 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 ...
Mule's user avatar
  • 43
0 votes
1 answer
125 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 ...
Junaid Ahmad's user avatar
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 ...
Rubens Vilhena Fonseca's user avatar
1 vote
1 answer
106 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 ...
Learner's user avatar
  • 219
1 vote
1 answer
111 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 ...
Learner's user avatar
  • 219
2 votes
1 answer
147 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 ...
lesobrod's user avatar
  • 1,667
2 votes
2 answers
132 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 ...
Aaron Hendrickson's user avatar
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 ...
dantopa's user avatar
  • 1,060
-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 ...
supragyan priyadarshinee's user avatar
2 votes
1 answer
78 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, ...
a019's user avatar
  • 867
0 votes
1 answer
85 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 ...
user1234321's user avatar
1 vote
1 answer
112 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 ...
Math_student's user avatar
2 votes
2 answers
243 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: ...
CuriousDudeFromEgypt's user avatar
-1 votes
1 answer
101 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. ...
Dylan Levine's user avatar
2 votes
1 answer
68 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 ...
Junaid Ahmad's user avatar
5 votes
1 answer
103 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, ...
rani's user avatar
  • 321
8 votes
5 answers
832 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 ...
expression's user avatar
  • 5,642
0 votes
1 answer
41 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] ...
Jamie M's user avatar
  • 515
3 votes
3 answers
410 views

Better way to do such iteration

Consider such an iteration function ...
matrix42's user avatar
  • 6,996
1 vote
3 answers
515 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?
boii's user avatar
  • 43
-2 votes
2 answers
162 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 ...
boii's user avatar
  • 43
-2 votes
1 answer
115 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: ...
boii's user avatar
  • 43
0 votes
1 answer
119 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 ...
Süleyman Küçük's user avatar
2 votes
3 answers
127 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 ...
Junaid Ahmad's user avatar
0 votes
1 answer
226 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:...
Superunknown's user avatar
1 vote
1 answer
50 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 ...
user122916's user avatar
0 votes
0 answers
53 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$,...
Dan1618's user avatar
  • 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 $$\...
epselonzero's user avatar
3 votes
1 answer
75 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. ...
Чорны Бусел's user avatar
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 ...
rhermans's user avatar
  • 36.5k
0 votes
1 answer
161 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 ...
licheng's user avatar
  • 2,029
6 votes
4 answers
341 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, ...
Aschoolar's user avatar
  • 883
0 votes
0 answers
23 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: {&...
lesobrod's user avatar
  • 1,667
3 votes
1 answer
134 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 ...
Nandan's user avatar
  • 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 ...
Eldar Sultanow's user avatar
4 votes
1 answer
176 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 ...
Albus Black's user avatar
3 votes
2 answers
129 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$ ...
Albus Black's user avatar
1 vote
2 answers
97 views

Using Loop to find a specific Energy

I am given a Hamiltonian: ...
codebpr's user avatar
  • 2,233
3 votes
3 answers
117 views

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

This code ...
Rogo's user avatar
  • 920
2 votes
1 answer
375 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} ]
user236343's user avatar