Questions on using and specifying iterators used in Mathematica functions.

learn more… | top users | synonyms

8
votes
5answers
326 views

How to iterate over the columns of a Dataset?

I have a Dataset with a simple structure, like this: ...
6
votes
2answers
123 views

How to introduce two successive points inside the FixedPointList for each cycle?

If we want to draw the attraction basins of an iteration function of the following type $$x_{k+1}=x_k-\frac{f(x_k)}{\frac{f(x_k)-f(w_k)}{x_k-w_k}},$$ where $w_k=x_k+b f(x_k)$, $b\in R-\{0\}$, we can ...
5
votes
4answers
640 views

Plotting piecewise functions

I have a list of N functions called functionList. N can be any number. Also, I have a list ...
5
votes
1answer
222 views

Procedural to functional style

The following code generates an iterative mapping of some trigonometric functions. I have a couple questions about it. The first question is how to optimize this iterative process using mathematica's ...
5
votes
2answers
336 views

Table with multiple iterators running parallel

I want to use Table to generate a list, but it only allows one iterator to increment at a time. So in ...
5
votes
1answer
135 views

Calculating the Feigenbaum Constants

I would like to calculate the $δ$ and the $α$ Feigenbaum constants for the Logistic Map: \begin{equation} x_{n+1}=4μx_n(1-x_n)=f(x_n) \end{equation} as part of an undergraduate assigment of mine. I ...
4
votes
3answers
423 views

Skipping over iterator values in a Table

I have been using the built-in function Table for some computations. (The following is not an actual representation of the equations I am using). ...
4
votes
3answers
592 views

Plotting the convolution of the same probability density function with itself

I would like to compute the integral $$q_n(x)=\int_{B}^A q_{n-1} (\omega)f(x-\omega)\mathrm{d} \omega,\quad q_1=f,\quad n\geq 1.$$ for a given density function $f$. Basically it is the convolution ...
4
votes
2answers
135 views

ReplaceRepeated as a Looping construct?

There are a lot of discussions about looping constructs (notable example here). Wolfram language guides, as usually, contain most relevant links. Looping constructs guide has the following part on ...
4
votes
1answer
123 views

Iterating `Log` infinitely

How is it possible to find the limiting value of Log[x Log[x Log[x Log[...]]]] in Mathematica? Apparently, it should give ...
4
votes
2answers
89 views

Finding the smallest starting number producing a Collatz sequence of length 125 which ends with a value > 4

I'm supposed to do a Mathematica function that selects the smallest number not less or equal to 4 after 125 iterations. I am not good at coding, so some help/advice would be awesome. My code so far. ...
4
votes
3answers
119 views

How to evaluate an expression over a particular list of tuples?

NOTE: This question is very similar to this one but I realized reading at the answers that I made a mistake in the equation AND I was not clear enough about what I need (my apologies): I want to ...
4
votes
2answers
223 views

How can I write a Do loop that iterates over N iterators when N is not known a-priori?

For any positive integer $n$ which is not specified a priori, I can make $n$-tuple vector $v$ by v = Array[a, 1, n]. Now, given that $n$ is a positive integer which ...
4
votes
0answers
61 views

Can a single Sum with multiple iterators be different from nested Sums?

Multiple sums are documented with two or more iterators, for example: Sum[1/(j^2 (i + 1)^2), {i, 1, Infinity}, {j, 1, i}] however the same answer can be ...
3
votes
3answers
263 views

How would I write iterative code to try multiple coefficients for an equation?

So, I'm trying to solve a class of equations, and get all the solutions in a list. The general form looks like this: c == a*Sqrt[1-n] PlusMinus[b * Sqrt[n]] ...
3
votes
2answers
141 views

Why does the iterator index in Table not work here?

I type the following command line Table[D[#1,varx[[i]]] &,{i,3}] where varx is a vector of dummy variables ...
3
votes
1answer
92 views

Manipulating the elements of a list

Let's create some sample data tab = Table[{i, j, k}, {i, -3, 3}, {j, -3, 3}, {k, -3, 3}]; ICs = Flatten[tab, 2]; Nt = Length[ICs]; A $3\times3$ system of ...
3
votes
1answer
768 views

Passing an iterator [duplicate]

The code Table[i, {i, 5}] produces the output {1, 2, 3, 4, 5} whereas the code ...
3
votes
1answer
51 views

Reals in Range; unexpected result for non-standard Precision

I think I have encountered advice against using inexact numbers in specifications of ranges and iterator many times. I don't think I ever saw an example of unexpected results though, but today I found ...
3
votes
2answers
121 views

How to modify the elements of a list in a loop?

I have a list with points coordinates. And I'm trying to traverse it and perform some matrix operations on each point. But I have a problem with storing modified points in the initial list instead of ...
3
votes
1answer
91 views

.NET link - index of property

I have a property in .NET Type, which is actually a generic list of objects. When I try access the property using numeric index e.g. 10, this works. However when I iterate through indices using ...
3
votes
1answer
83 views

How do I make Mathematica nest argument changes?

I want something like Nest[f,x,n], but what where f is an argument change like a pushforward and x[t] is a function, for example, symbolically, and not in any sort of code: $$ F{x[t]} \equiv x[2t + ...
3
votes
1answer
145 views

Parallel Apply on a deeply nested expression

I have a deeply nested expression, i.e. something like {{{{...}..}..}..}, and I'd like to use Apply in a parallel fashion, e.g. ...
2
votes
3answers
144 views

What is the correct way to perform the Gram-Schmidt process?

Im trying to do a simple processing in Mathematica. My original code was in Matlab. Part of the computation is Gram-Schmidt process, which is an iterative calculation. Every vector is changed ...
2
votes
2answers
169 views

How to get the current index during a Scan iteration?

Is there a special keyword to get the current index in Scan ? For example, let say I have the following code : ...
2
votes
1answer
107 views

Generating by plots by rerunning code

I am new to Mathematica. I created a code where I can evaluate a parameter (denoted by PoA) for a random instance of a directed acyclic graph. The code is below. ...
2
votes
3answers
97 views

Perform For-loop and show output which meets a certain criterion

I am new to Mathematica and I have a For loop like so: For[i = 0, i < 15, i++, PowerMod[i, -1, 15]] Currently it doesn't output anything. The calculation I am ...
2
votes
1answer
151 views

Reproducing a Plot done with WolframAlpha [duplicate]

I have problem to draw in Mathematica a plot like this: Plot[{Sum[a^10*(-1)^(x-a), {a, 1, x}]}, {x, 1, 10}] The problem is that on the plot there is no graph. As ...
2
votes
3answers
207 views

How to code the following product?

I am trying to examine the properties of the following product for a given tuple $\vec \lambda = (\lambda_1, \lambda_2, \dots, \lambda_n)$, then the product is as follows: $$ \dim \Gamma_\lambda = ...
2
votes
2answers
136 views

Plot with sum and binomial command

A few days ago I asked about a problem with plotting a sum. You advise me to use Evaluate option, and that helped me very. But now I have a very similar problem, but i can't find the mistake. I have a ...
2
votes
1answer
84 views

Abstract iterator in Do

I'm trying to write a module. Its input is a matrix (tensor), the module should return new tensor with increased rank with 1. The new tensor is defined as $$ O \Rightarrow N_{\alpha \beta \ldots ...
2
votes
1answer
186 views

Dynamic process on graph

I have a question, which I failed to find an answer to myself. I'm a casual user of Mathematica, but do have some knowledge about Dynamic module and other "Advanced" features. My problem is ...
2
votes
0answers
64 views

How to use nest to reduce the memory eatting of mma?

I enconter a problem about number: If we have 5+3+2=151022 9+2+4=183652 8+6+3=482466 5+4+5=202541 then 7+2+5=? It is easy to get the first two group of numbers? for the ...
1
vote
1answer
257 views

Basins of attraction of equilibrium points

The Henon-Heiles potential is the following V = 1/2*(x^2 + y^2) - y*(1/3*y^2 - x^2); which has four equilibrium points ...
1
vote
1answer
101 views

PerfectNumber messes with my iterator

I am using Mathematica 10.4 (sorry bbgodfrey) (temporary message) Let mmVerbose = 10^2000 + 123123798797192983712873198273122323; kkVerbose = 10^7; The ...
1
vote
4answers
128 views

NestWhileList, control to show the second sequence

For example,each number will end up with 89 or 1, however , How can I generate a sequence with two sub sequence. f[n_] := IntegerDigits[n]^2 // Total One sub ...
1
vote
3answers
288 views

Table iteration over two ranges

I am trying to create a Table where the iterator has two ranges with different iteration steps. Let's consider a simple example: I want to find the square of the ...
1
vote
3answers
109 views

Use Do to evaluate an expression over two indices $i \ne j$ (over a list of tuples)?

I have an expression of the form: expr1[i_,j_] = Sum[\[Beta][j]*\[Phi][i, j]* C[i] I would like to evaluate this expression over i=1:4, j=1:4 with i!= j. One ...
1
vote
1answer
85 views

How to make a table of successive values

I want a list, where each entry is of the form {x,y}. I want x to go from $-\pi / 2$ all the way up to $\pi/2$. I also want ...
1
vote
2answers
116 views

How to use Fold with 3 variables [duplicate]

Suppose I define f[x_,y_,z_]:=x+y+z I wish to apply the Fold function to f along the lines of Fold[f,1,2,Range[10]] In ...
1
vote
2answers
258 views

How to use Mathematica in my Problem as I would use it in Matlab

I would like to calculate the convolution of a function with itself for $n$ times. Let $n$ be $10$. For $n=1$, I wont make any calculation and $f0$ is my function, when $n=2$, I will convolve $f0$ ...
1
vote
3answers
780 views

How many iterations of Newton's method are needed to achieve a given precision?

Consider using Newton's method to solve the equation $arctan(x) = 0$. Using an initial guess of $x_0 = 1/2$ produces a sequence that converges rapidly. After $8$, iterations, $x_8$ is accurate to well ...
1
vote
1answer
61 views

How to write a loop to run iterations of functions to obtain different values? [closed]

I am trying to iterate the function a, b and td2 (10 times) inside a For loop. This will gives me 10 different values of td2 which eventually gives me 10 different values of fullData2. In another ...
1
vote
1answer
64 views

Plotting Invariant Manifolds of the Henon Map

Given the following map: \begin{align} & x_{n+1}=-y_n+2x_n^2 \\ & y_{n+1}=\beta x_n \end{align} for $β \in (0,1)$, $x_n \in \mathbb{R}, y_n \in \mathbb{R}$ (which is a one parameter version ...
1
vote
1answer
52 views

Define a function interactively with sum

I have to define a function which has 1e4 terms added up together. f(x1, x2) = (sum i, j, k, l from 1 to 10) (C(i) * C(j) * C(k) * C(l) * exp( (alpha(i)+alpha(j)) * x1 + (alpha(k)+alpha(l)) * x2 ...
1
vote
1answer
128 views

How do I produce iterative equations and bifurcation diagrams?

I need to produce orbit diagrams for different values of x for the following equation: f[r_][x_]:= r*x - x^3 I'm fairly new to Mathematica, so I haven't had a ...
1
vote
1answer
82 views

Tiny question about Indexed[x,n]

Maybe I should apologize for this silly question, but the documentation for Indexed is very short and not explicit. I have an equation with variables ...
1
vote
2answers
104 views

Generating a table with two entries for each i

Disclaimer: I'm not a mathematica expert, I have some programming experience but am still learning how to work mathematica. Also, some of the code from the first block here is not my own, ...
1
vote
1answer
180 views

invert system of two parametric ODEs and plot results of do-loop

I can solve this system of parametric ODE (u is the parameter,while g,e and ...
1
vote
1answer
161 views

Convolution of a denstity function having a point mass with itself

My density function is as follows: ...