Questions tagged [iteration]
The iteration tag has no usage guidance.
70
questions
1
vote
1answer
67 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 ...
0
votes
1answer
53 views
0
votes
1answer
56 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 ...
1
vote
1answer
38 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:
...
1
vote
2answers
95 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 ...
1
vote
1answer
180 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
...
1
vote
1answer
74 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 ...
2
votes
2answers
131 views
Running a notebook which imports and exports files repeatedly
I am trying to automate the process of running a Mathematica notebook that takes as an input a .txt file and exports another .txt file. This notebook was not written by me, and I don't fully ...
-2
votes
1answer
31 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 ...
1
vote
1answer
54 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 ...
1
vote
1answer
104 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_{...
2
votes
2answers
106 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....
0
votes
0answers
62 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 ...
1
vote
2answers
118 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 ...
0
votes
2answers
56 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.
...
0
votes
1answer
102 views
Newton's divided differences iteration
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 ...
5
votes
1answer
70 views
What is the most efficient way to implement NestPairWhileList[f,expr,test,g]
Question
NestWhileList[f,x,test] lets you iterate a function until a condition is satisfied, outputting the list of iterated values
...
0
votes
0answers
48 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 ...
1
vote
0answers
44 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 ...
3
votes
1answer
34 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 ...
3
votes
2answers
39 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 ...
2
votes
3answers
80 views
Performing iterated integrals
I would like to define a function $f_n(x)$ and plot it with Manipulate. The function is defined by
$$
f_{n+1}(x)=\frac{1}{\int_0^1(f_n(x'))^2dx'}\left(\int_0^xf_n(x'...
3
votes
1answer
95 views
How can I iteratively add elements to a list
Basically I want to make a histogram with a list of dates by using DateHistogram[]. However I have the data of the dates in nested list format, with elements like ...
4
votes
1answer
179 views
Coding the Mandelbrot Set for Beginners
I'm new to Mathematica and will need some help in coding the Mandelbrot set.
I don't want to use MandelbrotSetPlot since I want to understand the interior ...
10
votes
3answers
856 views
Simple Fractal square
I am working on a math question about infinite series, and one of the question images is below.
Each new white square has an area that is 1/4 of the previous square.
Always looking to learn elegant ...
0
votes
0answers
36 views
Running Nestlist with multiple functions
I want to create a iteration with a loop for my Nestlist with multiple functions. The following code is a very simplified one.
...
0
votes
2answers
51 views
Current iteration number in “do” command
How can I obtain the current iteration number of the "Do" command? For example I want $N$ to be my iteration number in the following command:
...
0
votes
0answers
34 views
Nested for loop with variable length
I am new to mathematica and I want to create the set of all n-tuples whose sum is less than a fixed number $N$. My idea would be to do a for loop where I choose first number $k_1$ in between 0 and N, ...
1
vote
0answers
45 views
Recursion depth of 1024 exceeded during evaluation of … when importing a directory with many files
I'm doing this:
Import["/Volumes/Transcend2/images/", "*.jpg"];
And getting these errors:
Then, after it's done, when I type "images" and shift+enter, I just ...
0
votes
1answer
161 views
Plotting Data Iteratively
I have a function of x1 that I can plot in the form y=f(x1). However, I have a relation y=f(x1)=f(x2), where I don't know the form of f(x2), but I can solve for x2 given f(x1) and I want to plot both ...
0
votes
0answers
24 views
Optimization of storages capacity
Consider a series of storages where different goods are added into daily. I would like to optimize the distribution of these goods between the storages in a way which takes into account some ...
1
vote
1answer
36 views
Get all step values from a while-loop
I did a loop (first of my life) for an iterative calculation. Is it possible to get all step values as a matrix. That means the "xValue" variable should be like {215.108,219.688,...} and not only the ...
4
votes
1answer
90 views
Iterative comparison between different vectors
I have some soccer outcomes for each league round to import in a data form similar to that:
...
1
vote
1answer
76 views
Iterative Bisector Method for finding the minimum of a non - differentiable function [closed]
I would like to automate a process to find the minimum of a non-differentiable function, perhaps using a similar system as the bisection method but adapted to finding minima instead of roots. Any ...
1
vote
1answer
31 views
cannot get EvaluationMonitor to output number of iterations taken to find a root
I was given the following problem:
Consider the equation x = exp(-x2). Plot the two curves on the same plot to get a rough idea of the intersection point. Then use a built - in function (e.g. ...
1
vote
3answers
93 views
Create a new matrix from an existing matrix and then plot it
I have some code will test an equation and finds values for (n,j,k,l) in which the expression is true and puts them in the matrix - here is the code.
...
3
votes
2answers
85 views
Fixed point of a vector
It seems to me that FixedPoint is designed to work with a particular value, but what if we want it to operate on a vector instead?
I start with an nxn matrix mat and the function:
...
0
votes
2answers
83 views
-2
votes
1answer
94 views
turn infinite loop into finite loop
I am trying to make a table where I can save the stock value with the iterative part, where I should have 100 sequence with 843 entry in each sequence.
The loop doesn't run correctly in the sense ...
0
votes
1answer
31 views
Reading and re-assigning variable
I am trying to create a table by iteratively calculating its values using a temporary variable accu:
...
1
vote
2answers
136 views
1
vote
2answers
103 views
Apply NestList to Iteratively Calculate Gradient (Gradient Descent)
I'm attempting to calculate the gradient of a function defined by two variables.
After following a tutorial I found, I have the following code:
...
1
vote
0answers
54 views
Need help with understanding a question concerning the power iteration method [closed]
I just need help understanding a question. I was given the question
Use the power iteration method to estimate the spectral radius for (I - B A) given a tridiagonal coefficient matrix.
Although,...
1
vote
1answer
62 views
0
votes
1answer
155 views
Solving a system of linear equations with a For-loop [closed]
I need to find the value of c1, c2, c3, c4 and c5, but the output from my code is the simplified equations, not the exact value ...
0
votes
0answers
52 views
Iterating over a list and defining the range accordingly
I have the following list,
l = {{"a", "b"}, {"a", "b"}, {"c", "d"}, {"e", "f"}, {"e", "f"},
{"x", "y", "z"}, {"m", "n", "o"}, {"p", "q", "s"}};
for each ...
0
votes
2answers
98 views
In an iterative process, how does one simply bypass a step producing an error? [closed]
This is undoubtedly rather elementary, but the remedy escapes me presently (and does not, as far as I can see, readily appear in Help).
I'm engaged in an iterative process with several computations ...
1
vote
2answers
75 views
0
votes
2answers
187 views
solve the iterative integral equatio [duplicate]
The following code is incorrect, please specify my mistakes
...
0
votes
1answer
81 views
Solve integral equation by iteration
For[{n = 1, y[0][x_] = 1}, n < 4, n++,
y[n][x_] = 1 + Integrate[y[n - 1][t]^2 + t^2, {t, 0, x}];
Print[{n, y[n][t]}]]
here how can I get table of values ...