Questions tagged [iteration]
The iteration tag has no usage guidance.
173
questions
0
votes
1
answer
84
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 ...
2
votes
2
answers
213
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: ...
-1
votes
1
answer
91
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.
...
1
vote
1
answer
46
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
91
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,
...
8
votes
5
answers
731
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 ...
0
votes
1
answer
36
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]
...
0
votes
0
answers
37
views
Mathematica script not running properly on remote server
I am trying to run a mathmatica script on an hpc. First I converted the .nb into a .m file and changed the cell properties to initialization. But I am getting several errors while submitting the job ...
3
votes
3
answers
392
views
Better way to do such iteration
Consider such an iteration function
...
0
votes
0
answers
72
views
Implement of Euler Method of Parabolic PDE
I'm experimenting with different schemes for numerically solving PDEs in Mathematica. I use NestList to implement the Euler Method for 1-D PDE, the code is concise:
...
1
vote
3
answers
476
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?
-2
votes
2
answers
104
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 ...
-2
votes
1
answer
87
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:
...
0
votes
1
answer
111
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 ...
1
vote
3
answers
86
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
181
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:...
1
vote
1
answer
41
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 ...
0
votes
0
answers
37
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$,...
1
vote
2
answers
97
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
54
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 ...
0
votes
1
answer
100
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 ...
6
votes
4
answers
312
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,
...
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: {&...
3
votes
1
answer
109
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 ...
1
vote
1
answer
57
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 ...
4
votes
1
answer
112
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 ...
3
votes
2
answers
118
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
2
answers
92
views
Using Loop to find a specific Energy
I am given a Hamiltonian:
...
3
votes
3
answers
107
views
2
votes
1
answer
295
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}
]
0
votes
1
answer
205
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}...
0
votes
1
answer
148
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 ...
0
votes
1
answer
105
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 ...
0
votes
0
answers
61
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+\...
3
votes
1
answer
134
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 "...
5
votes
3
answers
286
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 ...
2
votes
3
answers
266
views
Nested floor functions
I would like to compute a limit involving a particular nested floor function. For example:
...
3
votes
4
answers
354
views
Defining a function iteratively without Mathematica getting stuck in a recursion loop
I have the following code:
...
1
vote
3
answers
68
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 ...
0
votes
1
answer
182
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 ...
0
votes
1
answer
178
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 ...
1
vote
1
answer
62
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 <...
10
votes
2
answers
524
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). ...
0
votes
2
answers
122
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 ...
5
votes
2
answers
462
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
...
0
votes
0
answers
82
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 ...
0
votes
0
answers
127
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 ...
0
votes
0
answers
75
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 ...
0
votes
0
answers
41
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.
...