Questions tagged [iteration]
The iteration tag has no usage guidance.
185
questions
0
votes
0
answers
31
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
71
views
Can't use iterative variable as part specification [closed]
I've got the following mathematica code:
...
0
votes
0
answers
43
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 ...
1
vote
3
answers
93
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 ...
0
votes
1
answer
119
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
63
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
93
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 ...
1
vote
1
answer
108
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 ...
2
votes
1
answer
127
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 ...
2
votes
2
answers
128
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
65
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 ...
-2
votes
1
answer
66
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
77
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,
...
0
votes
1
answer
79
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
96
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
232
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
100
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.
...
2
votes
1
answer
59
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
99
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
803
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
39
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]
...
3
votes
3
answers
406
views
Better way to do such iteration
Consider such an iteration function
...
0
votes
0
answers
103
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
503
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
134
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
108
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
116
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
112
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
215
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
47
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
47
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
102
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
65
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
138
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
331
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
131
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
69
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
157
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
127
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
93
views
Using Loop to find a specific Energy
I am given a Hamiltonian:
...
3
votes
3
answers
112
views
2
votes
1
answer
355
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
301
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
154
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
110
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
68
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
144
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
318
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 ...